View Javadoc

    1   /**
    2    *
    3    * Copyright 2003-2004 The Apache Software Foundation
    4    *
    5    *  Licensed under the Apache License, Version 2.0 (the "License");
    6    *  you may not use this file except in compliance with the License.
    7    *  You may obtain a copy of the License at
    8    *
    9    *     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
    18  //
    19  // This source code implements specifications defined by the Java
    20  // Community Process. In order to remain compliant with the specification
    21  // DO NOT add / change / or delete method signatures!
    22  //
    23
    24  package javax.servlet.jsp;
    25
    26  /**
    27   * Contains information about an error, for error pages.
    28   * The information contained in this instance is meaningless if not used
    29   * in the context of an error page.  To indicate a JSP is an error page,
    30   * the page author must set the isErrorPage attribute of the page directive
    31   * to "true".
    32   *
    33   * @see PageContext#getErrorData
    34   * @since 2.0
    35   */
    36
    37  public final class ErrorData {
    38
    39      private Throwable throwable;
    40      private int statusCode;
    41      private String uri;
    42      private String servletName;
    43
    44      /**
    45       * Creates a new ErrorData object.
    46       *
    47       * @param throwable The Throwable that is the cause of the error
    48       * @param statusCode The status code of the error
    49       * @param uri The request URI
    50       * @param servletName The name of the servlet invoked
    51       */
    52      public ErrorData( Throwable throwable, int statusCode, String uri,
    53  	String servletName )
    54      {
    55  	this.throwable = throwable;
    56  	this.statusCode = statusCode;
    57  	this.uri = uri;
    58  	this.servletName = servletName;
    59      }
    60
    61      /**
    62       * Returns the Throwable that caused the error.
    63       *
    64       * @return The Throwable that caused the error
    65       */
    66      public Throwable getThrowable() {
    67  	return this.throwable;
    68      }
    69
    70      /**
    71       * Returns the status code of the error.
    72       *
    73       * @return The status code of the error
    74       */
    75      public int getStatusCode() {
    76  	return this.statusCode;
    77      }
    78
    79      /**
    80       * Returns the request URI.
    81       *
    82       * @return The request URI
    83       */
    84      public String getRequestURI() {
    85  	return this.uri;
    86      }
    87
    88      /**
    89       * Returns the name of the servlet invoked.
    90       *
    91       * @return The name of the servlet invoked
    92       */
    93      public String getServletName() {
    94  	return this.servletName;
    95      }
    96  }