@ManagedObject(value="Context Handler Collection") public class ContextHandlerCollection extends HandlerCollection
HandlerCollection
is creates a
Map of contexts to it's contained handlers based
on the context path and virtual hosts of any contained ContextHandler
s.
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.Modifier and Type | Class and Description |
---|---|
private static class |
ContextHandlerCollection.Branch |
private static class |
ContextHandlerCollection.Mapping |
HandlerCollection.Handlers
AbstractHandler.ErrorDispatchHandler
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Container.InheritedListener, Container.Listener
Modifier and Type | Field and Description |
---|---|
private java.lang.Class<? extends ContextHandler> |
_contextClass
Deprecated.
|
private SerializedExecutor |
_serializedExecutor |
private static Logger |
LOG |
_handlers
Constructor and Description |
---|
ContextHandlerCollection() |
ContextHandlerCollection(ContextHandler... contexts) |
Modifier and Type | Method and Description |
---|---|
ContextHandler |
addContext(java.lang.String contextPath,
java.lang.String resourceBase)
Deprecated.
Unused convenience method no longer supported.
|
void |
deployHandler(Handler handler,
Callback callback)
Thread safe deploy of a Handler.
|
java.lang.Class<?> |
getContextClass()
Deprecated.
Unused convenience mechanism not used.
|
void |
handle(java.lang.String target,
Request baseRequest,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handle a request.
|
void |
mapContexts()
Remap the contexts.
|
protected HandlerCollection.Handlers |
newHandlers(Handler[] handlers) |
void |
setContextClass(java.lang.Class<? extends ContextHandler> contextClass)
Deprecated.
Unused convenience mechanism not used.
|
void |
undeployHandler(Handler handler,
Callback callback)
Thread safe undeploy of a Handler.
|
addHandler, destroy, expandChildren, getHandlers, prependHandler, removeHandler, setHandlers, updateHandlers
doShutdown, expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass, setServer
doError, doStart, doStop, getServer
addBean, addBean, addBean, addEventListener, addManaged, contains, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, start, stop, stop
dumpContainer, dumpIterable, dumpMapEntries, dumpObjects, dumpSelf, named
private static final Logger LOG
private final SerializedExecutor _serializedExecutor
@Deprecated private java.lang.Class<? extends ContextHandler> _contextClass
public ContextHandlerCollection()
public ContextHandlerCollection(ContextHandler... contexts)
@ManagedOperation(value="Update the mapping of context path to context") public void mapContexts()
HandlerCollection.setHandlers(Handler[])
However, if configuration changes in the deep handler structure (eg contextpath is changed), then
this call will trigger a remapping.
This method is mutually excluded from deployHandler(Handler, Callback)
and
undeployHandler(Handler, Callback)
protected HandlerCollection.Handlers newHandlers(Handler[] handlers)
newHandlers
in class HandlerCollection
public void handle(java.lang.String target, Request baseRequest, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
Handler
handle
in interface Handler
handle
in class HandlerCollection
target
- The target of the request - either a URI or a name.baseRequest
- The original unwrapped request object.request
- The request either as the Request
object or a wrapper of that request. The
HttpConnection.getCurrentConnection()
.getHttpChannel()
.getRequest()
method can be used access the Request object if required.response
- The response as the Response
object or a wrapper of that request. The
HttpConnection.getCurrentConnection()
.getHttpChannel()
.getResponse()
method can be used access the Response object if required.java.io.IOException
- if unable to handle the request or response processingjavax.servlet.ServletException
- if unable to handle the request or response due to underlying servlet issue@Deprecated public ContextHandler addContext(java.lang.String contextPath, java.lang.String resourceBase)
contextPath
- The context path to addresourceBase
- the base (root) Resourcepublic void deployHandler(Handler handler, Callback callback)
This method is the equivalent of HandlerCollection.addHandler(Handler)
,
but its execution is non-block and mutually excluded from all
other calls to deployHandler(Handler, Callback)
and
undeployHandler(Handler, Callback)
.
The handler may be added after this call returns.
handler
- the handler to deploycallback
- Called after handler has been addedpublic void undeployHandler(Handler handler, Callback callback)
This method is the equivalent of HandlerCollection.removeHandler(Handler)
,
but its execution is non-block and mutually excluded from all
other calls to deployHandler(Handler, Callback)
and
undeployHandler(Handler, Callback)
.
The handler may be removed after this call returns.
handler
- The handler to undeploycallback
- Called after handler has been removed@Deprecated public java.lang.Class<?> getContextClass()
@Deprecated public void setContextClass(java.lang.Class<? extends ContextHandler> contextClass)
contextClass
- The class to use to add new Contexts