com.caucho.servlets
Class ErrorStatusServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by com.caucho.servlets.ErrorStatusServlet
All Implemented Interfaces:
java.io.Serializable, Servlet, ServletConfig

public class ErrorStatusServlet
extends GenericServlet

Use ServletResponse.sendError() to send an error to the client.

 <servlet>
   <servlet-name>forbidden</servlet-name>
   <servlet-class>com.caucho.servlets.ErrorStatusServlet</servlet-class>
   <init>
     <status-code>403</status-code>
     <message>You cannot look at that.</message>
   </init>
 </servlet>

 <servlet-mapping url-pattern="*.properties" servlet-name="forbidden"/>
 <servlet-mapping url-pattern="/config/*" servlet-name="forbidden"/>
 

See Also:
Serialized Form

Constructor Summary
ErrorStatusServlet()
           
 
Method Summary
 void service(ServletRequest request, ServletResponse response)
          Service a request.
 void setMessage(java.lang.String message)
          The message to send, default is to send no message.
 void setStatusCode(int code)
          The status code to send, default 404 (Not Found).
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ErrorStatusServlet

public ErrorStatusServlet()
Method Detail

setStatusCode

public void setStatusCode(int code)
The status code to send, default 404 (Not Found).


setMessage

public void setMessage(java.lang.String message)
The message to send, default is to send no message.


service

public void service(ServletRequest request,
                    ServletResponse response)
             throws ServletException,
                    java.io.IOException
Description copied from interface: Servlet
Service a request. Since the servlet engine is multithreaded, many threads may execute service simultaneously. Normally, req and res will actually be HttpServletRequest and HttpServletResponse classes.

Parameters:
request - request information. Normally servlets will cast this to HttpServletRequest
response - response information. Normally servlets will cast this to HttpServletRequest
Throws:
ServletException
java.io.IOException