com.bea.p13n.servlets
Class SendErrorServlet
java.lang.Object
HttpServlet
com.bea.p13n.servlets.SendErrorServlet
public class SendErrorServlet
- extends 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>
Method Summary |
void |
init()
Initializes the error code from the "errorCode" init param, if
set (otherwise, defaults to 404). |
void |
service(HttpServletRequest request,
HttpServletResponse response)
Calls response.sendError( errorCode), where errorCode is specified by the
"errorCode" init param (which defaults to 404). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SendErrorServlet
public SendErrorServlet()
init
public void init()
throws ServletException
- Initializes the error code from the "errorCode" init param, if
set (otherwise, defaults to 404).
- Throws
ServletException
service
public void service(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,
IOException
- Calls response.sendError( errorCode), where errorCode is specified by the
"errorCode" init param (which defaults to 404).
- Throws
ServletException
IOException
Copyright © 2006 BEA Systems, Inc. All Rights Reserved