Top Description Fields Constructors Methods
org.mortbay.jetty.handler

public Class ContextHandlerCollection

extends HandlerCollection
Class Inheritance
Imports
java.io.IOException, java.util.HashMap, .Map, javax.servlet.ServletException, javax.servlet.http.HttpServletRequest, .HttpServletResponse, org.mortbay.jetty.Handler, .HandlerContainer, .HttpConnection, .Request, org.mortbay.jetty.servlet.PathMap, org.mortbay.log.Log, org.mortbay.util.LazyList

ContextHandlerCollection. This org.mortbay.jetty.handler.HandlerCollection is creates a org.mortbay.jetty.servlet.PathMap to it's contained handlers based on the context path and virtual hosts of any contained org.mortbay.jetty.handler.ContextHandlers. The contexts do not need to be directly contained, only children of the contained handlers. Multiple contexts may have the same context path and they are called in order until one handles the request.

Field Summary

Modifier and TypeField and Description
private Class<T>
private PathMap

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ContextHandler
addContext(String
The context path to add
contextPath
,
String resourceBase)

Add a context handler.

protected void
public Class<T>

Returns:

The class to use to add new Contexts
getContextClass
()

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.HandlerCollection.handle.

Implements org.mortbay.jetty.Handler.handle.

Handle a request.
public void
mapContexts()

Remap the context paths.

private String
public void
setContextClass(Class<T>
The class to use to add new Contexts
contextClass
)

public void
Inherited from org.mortbay.jetty.handler.HandlerCollection:
addHandlerdoStopexpandChildrengetHandlersremoveHandlersetServer

Field Detail

_contextClassback to summary
private Class<T> _contextClass
_contextMapback to summary
private PathMap _contextMap

Constructor Detail

ContextHandlerCollectionback to summary
public ContextHandlerCollection()

Method Detail

addContextback to summary
public ContextHandler addContext(String contextPath, String resourceBase)

Add a context handler.

Parameters
contextPath:String

The context path to add

doStartback to summary
protected void doStart() throws Exception

Overrides org.mortbay.jetty.handler.HandlerCollection.doStart.

getContextClassback to summary
public Class<T> getContextClass()
Returns:Class<T>

The class to use to add new Contexts

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

Overrides org.mortbay.jetty.handler.HandlerCollection.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

mapContextsback to summary
public void mapContexts()

Remap the context paths.

normalizeHostnameback to summary
private String normalizeHostname(String host)
setContextClassback to summary
public void setContextClass(Class<T> contextClass)
Parameters
contextClass:Class<T>

The class to use to add new Contexts

setHandlersback to summary
public void setHandlers(Handler[] handlers)

Overrides org.mortbay.jetty.handler.HandlerCollection.setHandlers.

Parameters
handlers:Handler[]

Doc from org.mortbay.jetty.handler.HandlerCollection.setHandlers.

The handlers to set.