Top Description Inners Fields Constructors Methods
org.mortbay.jetty.servlet

public Class ErrorPageErrorHandler

extends ErrorHandler
Class Inheritance
Imports
java.io.IOException, java.util.ArrayList, .HashMap, .List, .Map, javax.servlet.ServletContext, .ServletException, javax.servlet.http.HttpServletRequest, .HttpServletResponse, org.mortbay.jetty.Dispatcher, .HttpConnection, .HttpMethods, org.mortbay.jetty.handler.ContextHandler, .ErrorHandler, org.mortbay.log.Log, org.mortbay.util.TypeUtil

Error Page Error Handler An ErrorHandler that maps exceptions and status codes to URIs for dispatch using the internal ERROR style of dispatch.
Author
gregw

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
protected List<E>
protected Map<K, V>
protected ServletContext
public static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addErrorPage(Class<T>
The class (or superclass) of the matching exceptions
exception
,
String
The URI of the error page.
uri
)

Add Error Page mapping for an exception class This method is called as a result of an exception-type element in a web.xml file or may be called directly

public void
addErrorPage(int
The HTTP status code to match
code
,
String
The URI of the error page.
uri
)

Add Error Page mapping for a status code.

public void
addErrorPage(int
The lowest matching status code
from
,
int
The highest matching status code
to
,
String
The URI of the error page.
uri
)

Add Error Page mapping for a status code range.

protected void
protected void
public Map<K, V>

Returns:

Returns the errorPages.
getErrorPages
()

public void
handle(String
The target of the request - either a URI or a name.
target
,
HttpServletRequest
The request either as the Request object or a wrapper of that request. The HttpConnection#getCurrentConnection() method can be used access the Request object if required.
request
,
HttpServletResponse
The response as the Response object or a wrapper of that request. The HttpConnection#getCurrentConnection() method can be used access the Response object if required.
response
,
int
The dispatch mode: REQUEST, FORWARD, INCLUDE, ERROR
dispatch
)

Overrides org.mortbay.jetty.handler.ErrorHandler.handle.

Implements org.mortbay.jetty.Handler.handle.

Handle a request.
public void
setErrorPages(Map<K, V>
The errorPages to set. A map of Exception class name or error code as a string to URI string
errorPages
)

Inherited from org.mortbay.jetty.handler.ErrorHandler:
handleErrorPageisShowStackssetShowStackswriteErrorPagewriteErrorPageBodywriteErrorPageHeadwriteErrorPageMessagewriteErrorPageStacks

Field Detail

_errorPageListback to summary
protected List<E> _errorPageList
_errorPagesback to summary
protected Map<K, V> _errorPages
_servletContextback to summary
protected ServletContext _servletContext
ERROR_PAGEback to summary
public static final String ERROR_PAGE

Constructor Detail

ErrorPageErrorHandlerback to summary
public ErrorPageErrorHandler()

Method Detail

addErrorPageback to summary
public void addErrorPage(Class<T> exception, String uri)

Add Error Page mapping for an exception class This method is called as a result of an exception-type element in a web.xml file or may be called directly

Parameters
exception:Class<T>

The class (or superclass) of the matching exceptions

uri:String

The URI of the error page.

addErrorPageback to summary
public void addErrorPage(int code, String uri)

Add Error Page mapping for a status code. This method is called as a result of an error-code element in a web.xml file or may be called directly

Parameters
code:int

The HTTP status code to match

uri:String

The URI of the error page.

addErrorPageback to summary
public void addErrorPage(int from, int to, String uri)

Add Error Page mapping for a status code range. This method is not available from web.xml and must be called directly.

Parameters
from:int

The lowest matching status code

to:int

The highest matching status code

uri:String

The URI of the error page.

doStartback to summary
protected void doStart() throws Exception

Overrides org.mortbay.jetty.handler.AbstractHandler.doStart.

doStopback to summary
protected void doStop() throws Exception

Overrides org.mortbay.jetty.handler.AbstractHandler.doStop.

getErrorPagesback to summary
public Map<K, V> getErrorPages()
Returns:Map<K, V>

Returns the errorPages.

handleback to summary
public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException

Overrides org.mortbay.jetty.handler.ErrorHandler.handle.

Implements org.mortbay.jetty.Handler.handle.

Doc from org.mortbay.jetty.Handler.handle.

Handle a request.

Parameters
target:String

The target of the request - either a URI or a name.

request:HttpServletRequest

The request either as the Request object or a wrapper of that request. The HttpConnection#getCurrentConnection() method can be used access the Request object if required.

response:HttpServletResponse

The response as the Response object or a wrapper of that request. The HttpConnection#getCurrentConnection() method can be used access the Response object if required.

dispatch:int

The dispatch mode: REQUEST, FORWARD, INCLUDE, ERROR

setErrorPagesback to summary
public void setErrorPages(Map<K, V> errorPages)
Parameters
errorPages:Map<K, V>

The errorPages to set. A map of Exception class name or error code as a string to URI string

org.mortbay.jetty.servlet back to summary

private Class ErrorPageErrorHandler.ErrorCodeRange

extends Object
Class Inheritance
  • java.lang.Object
  • org.mortbay.jetty.servlet.ErrorPageErrorHandler.ErrorCodeRange

Field Summary

Modifier and TypeField and Description
private int
private int
private String

Constructor Summary

AccessConstructor and Description
pack-priv
ErrorCodeRange(int from, int to, String uri)

Method Summary

Modifier and TypeMethod and Description
pack-priv String
pack-priv boolean
isInRange(int value)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_fromback to summary
private int _from
_toback to summary
private int _to
_uriback to summary
private String _uri

Constructor Detail

ErrorCodeRangeback to summary
pack-priv ErrorCodeRange(int from, int to, String uri) throws IllegalArgumentException

Method Detail

getUriback to summary
pack-priv String getUri()
isInRangeback to summary
pack-priv boolean isInRange(int value)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object