001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * Portions Copyright Apache Software Foundation.
007: *
008: * The contents of this file are subject to the terms of either the GNU
009: * General Public License Version 2 only ("GPL") or the Common Development
010: * and Distribution License("CDDL") (collectively, the "License"). You
011: * may not use this file except in compliance with the License. You can obtain
012: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
013: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
014: * language governing permissions and limitations under the License.
015: *
016: * When distributing the software, include this License Header Notice in each
017: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
018: * Sun designates this particular file as subject to the "Classpath" exception
019: * as provided by Sun in the GPL Version 2 section of the License file that
020: * accompanied this code. If applicable, add the following below the License
021: * Header, with the fields enclosed by brackets [] replaced by your own
022: * identifying information: "Portions Copyrighted [year]
023: * [name of copyright owner]"
024: *
025: * Contributor(s):
026: *
027: * If you wish your version of this file to be governed by only the CDDL or
028: * only the GPL Version 2, indicate your decision by adding "[Contributor]
029: * elects to include this software in this distribution under the [CDDL or GPL
030: * Version 2] license." If you don't indicate a single choice of license, a
031: * recipient has the option to distribute your version of this file under
032: * either the CDDL, the GPL Version 2 or to extend the choice of license to
033: * its licensees as provided above. However, if you add GPL Version 2 code
034: * and therefore, elected the GPL Version 2 license, then the option applies
035: * only if the new code is made subject to such option by the copyright
036: * holder.
037: */
038: package javax.servlet.jsp;
039:
040: /**
041: * Contains information about an error, for error pages.
042: * The information contained in this instance is meaningless if not used
043: * in the context of an error page. To indicate a JSP is an error page,
044: * the page author must set the isErrorPage attribute of the page directive
045: * to "true".
046: *
047: * @see PageContext#getErrorData
048: * @since JSP 2.0
049: */
050:
051: public final class ErrorData {
052:
053: private Throwable throwable;
054: private int statusCode;
055: private String uri;
056: private String servletName;
057:
058: /**
059: * Creates a new ErrorData object.
060: *
061: * @param throwable The Throwable that is the cause of the error
062: * @param statusCode The status code of the error
063: * @param uri The request URI
064: * @param servletName The name of the servlet invoked
065: */
066: public ErrorData(Throwable throwable, int statusCode, String uri,
067: String servletName) {
068: this .throwable = throwable;
069: this .statusCode = statusCode;
070: this .uri = uri;
071: this .servletName = servletName;
072: }
073:
074: /**
075: * Returns the Throwable that caused the error.
076: *
077: * @return The Throwable that caused the error
078: */
079: public Throwable getThrowable() {
080: return this .throwable;
081: }
082:
083: /**
084: * Returns the status code of the error.
085: *
086: * @return The status code of the error
087: */
088: public int getStatusCode() {
089: return this .statusCode;
090: }
091:
092: /**
093: * Returns the request URI.
094: *
095: * @return The request URI
096: */
097: public String getRequestURI() {
098: return this .uri;
099: }
100:
101: /**
102: * Returns the name of the servlet invoked.
103: *
104: * @return The name of the servlet invoked
105: */
106: public String getServletName() {
107: return this.servletName;
108: }
109: }
|