Package: ErrorData
ErrorData
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ErrorData(Throwable, int, String, String) |
|
|
|
|
|
||||||||||||||||||||
ErrorData(Throwable, int, String, String, String, String) |
|
|
|
|
|
||||||||||||||||||||
getMethod() |
|
|
|
|
|
||||||||||||||||||||
getQueryString() |
|
|
|
|
|
||||||||||||||||||||
getRequestURI() |
|
|
|
|
|
||||||||||||||||||||
getServletName() |
|
|
|
|
|
||||||||||||||||||||
getStatusCode() |
|
|
|
|
|
||||||||||||||||||||
getThrowable() |
|
|
|
|
|
Coverage
1: /*
2: * Copyright (c) 1997, 2024 Oracle and/or its affiliates and others.
3: * All rights reserved.
4: * Copyright 2004 The Apache Software Foundation
5: *
6: * Licensed under the Apache License, Version 2.0 (the "License");
7: * you may not use this file except in compliance with the License.
8: * You may obtain a copy of the License at
9: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: package jakarta.servlet.jsp;
20:
21: /**
22: * Contains information about an error, for error pages. The information contained in this instance is meaningless if
23: * not used in the context of an error page. To indicate a JSP is an error page, the page author must set the
24: * isErrorPage attribute of the page directive to "true".
25: *
26: * @see PageContext#getErrorData
27: * @since JSP 2.0
28: */
29: public final class ErrorData {
30:
31: private final Throwable throwable;
32: private final int statusCode;
33: private final String method;
34: private final String uri;
35: private final String queryString;
36: private final String servletName;
37:
38: /**
39: * Creates a new ErrorData object.
40: *
41: * @param throwable The Throwable that is the cause of the error
42: * @param statusCode The status code of the error
43: * @param uri The request URI
44: * @param servletName The name of the servlet invoked
45: *
46: * @deprecated Use {@link ErrorData#ErrorData(Throwable, int, String, String, String, String)}
47: */
48: @Deprecated(since = "4.0", forRemoval = true)
49: public ErrorData(Throwable throwable, int statusCode, String uri, String servletName) {
50: this(throwable, statusCode, null, uri, servletName, null);
51: }
52:
53: /**
54: * Creates a new ErrorData object.
55: *
56: * @param throwable The Throwable that is the cause of the error
57: * @param statusCode The status code of the error
58: * @param method The request method
59: * @param uri The request URI
60: * @param servletName The name of the servlet invoked
61: * @param queryString The request query string
62: *
63: * @since JSP 4.0
64: */
65: public ErrorData(Throwable throwable, int statusCode, String method, String uri, String servletName,
66: String queryString) {
67: this.throwable = throwable;
68: this.statusCode = statusCode;
69: this.method = method;
70: this.uri = uri;
71: this.servletName = servletName;
72: this.queryString = queryString;
73: }
74:
75: /**
76: * Returns the Throwable that caused the error.
77: *
78: * @return The Throwable that caused the error
79: */
80: public Throwable getThrowable() {
81: return this.throwable;
82: }
83:
84: /**
85: * Returns the status code of the error.
86: *
87: * @return The status code of the error
88: */
89: public int getStatusCode() {
90: return this.statusCode;
91: }
92:
93: /**
94: * Returns the request method.
95: *
96: * @return The request method
97: *
98: * @since JSP 4.0
99: */
100: public String getMethod() {
101: return this.method;
102: }
103:
104: /**
105: * Returns the request URI.
106: *
107: * @return The request URI
108: */
109: public String getRequestURI() {
110: return this.uri;
111: }
112:
113: /**
114: * Returns the name of the servlet invoked.
115: *
116: * @return The name of the servlet invoked
117: */
118: public String getServletName() {
119: return this.servletName;
120: }
121:
122: /**
123: * Returns the request query string or {@code null} if the request had no
124: * query string.
125: *
126: * @return The request query string
127: *
128: * @since JSP 4.0
129: */
130: public String getQueryString() {
131: return this.queryString;
132: }
133: }