01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package javax.servlet.jsp;
18:
19: /**
20: * Contains information about an error, for error pages.
21: * The information contained in this instance is meaningless if not used
22: * in the context of an error page. To indicate a JSP is an error page,
23: * the page author must set the isErrorPage attribute of the page directive
24: * to "true".
25: *
26: * @see PageContext#getErrorData
27: * @since 2.0
28: */
29:
30: public final class ErrorData {
31:
32: private Throwable throwable;
33: private int statusCode;
34: private String uri;
35: private String servletName;
36:
37: /**
38: * Creates a new ErrorData object.
39: *
40: * @param throwable The Throwable that is the cause of the error
41: * @param statusCode The status code of the error
42: * @param uri The request URI
43: * @param servletName The name of the servlet invoked
44: */
45: public ErrorData(Throwable throwable, int statusCode, String uri,
46: String servletName) {
47: this .throwable = throwable;
48: this .statusCode = statusCode;
49: this .uri = uri;
50: this .servletName = servletName;
51: }
52:
53: /**
54: * Returns the Throwable that caused the error.
55: *
56: * @return The Throwable that caused the error
57: */
58: public Throwable getThrowable() {
59: return this .throwable;
60: }
61:
62: /**
63: * Returns the status code of the error.
64: *
65: * @return The status code of the error
66: */
67: public int getStatusCode() {
68: return this .statusCode;
69: }
70:
71: /**
72: * Returns the request URI.
73: *
74: * @return The request URI
75: */
76: public String getRequestURI() {
77: return this .uri;
78: }
79:
80: /**
81: * Returns the name of the servlet invoked.
82: *
83: * @return The name of the servlet invoked
84: */
85: public String getServletName() {
86: return this.servletName;
87: }
88: }
|