Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.p13n.servlets
Class SendErrorServlet

    java.lang.Object
      javax.servlet.GenericServlet
          javax.servlet.http.HttpServlet
              com.bea.p13n.servlets.SendErrorServlet

All Implemented Interfaces
  Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

    public class SendErrorServlet

extends javax.servlet.http.HttpServlet

This servlet simply sends an error code. The only reason you might need such a thing is to override a servlet that has been deployed in a Library Module. Due to the way descriptor merging works for web.xml, you can not "turn off" a servlet which is deployed in a library's web.xml. There is not anything available in your web app's web.xml to turn such a servlet off. Therefore, the only thing you can do is override the servlet with one that sends errors (usually 404, which is what this servlet does. This servlet understands one optional init parameter named "errorCode", which should be an integer for the code this servlet should send. It defaults to 404.

For example, maybe a library module contains a servlet such as:

        <servlet>
          <servlet-name>SomeServlet</servlet-name>
          <servlet-class>org.foo.TheServlet</servlet-class>
        </servlet>

You can override this in your application's web.xml using the same servlet-name, like this:

        <servlet>
          <servlet-name>SomeServlet</servlet-name>
          <servlet-class>com.bea.p13n.servlets.SendErrorServlet</servlet-class>
        </servlet>

See Also
  Serialized Form

Constructor Summary
`SendErrorServlet()`

Method Summary
`void` | `init()` Initializes the error code from the "errorCode" init param, if set (otherwise, defaults to 404).
`void` | `service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)` Calls response.sendError( errorCode), where errorCode is specified by the "errorCode" init param (which defaults to 404).

Methods inherited from class javax.servlet.http.HttpServlet
`doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service`

Methods inherited from class javax.servlet.GenericServlet
`destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SendErrorServlet

    public SendErrorServlet()

Method Detail

### init

    public void init()
              throws javax.servlet.ServletException

  Initializes the error code from the "errorCode" init param, if set (otherwise, defaults to 404).

  Overrides:
    `init` in class `javax.servlet.GenericServlet`
  Throws
    `javax.servlet.ServletException`

### service

    public void service(javax.servlet.http.HttpServletRequest request,
                        javax.servlet.http.HttpServletResponse response)
                 throws javax.servlet.ServletException,
                        IOException

  Calls response.sendError( errorCode), where errorCode is specified by the "errorCode" init param (which defaults to 404).

  Overrides:
    `service` in class `javax.servlet.http.HttpServlet`
  Throws
    `javax.servlet.ServletException`
    `IOException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.