Class ContextHandlerCollection

  • All Implemented Interfaces:
    Handler, HandlerContainer, org.eclipse.jetty.util.component.Container, org.eclipse.jetty.util.component.Destroyable, org.eclipse.jetty.util.component.Dumpable, org.eclipse.jetty.util.component.LifeCycle

    @ManagedObject("Context Handler Collection")
    public class ContextHandlerCollection
    extends HandlerCollection
    ContextHandlerCollection. This HandlerCollection is creates a Map of contexts to it's contained handlers based on the context path and virtual hosts of any contained 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.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

        org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener
      • Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container

        org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.Listener
      • Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle

        org.eclipse.jetty.util.component.LifeCycle.Listener
    • Field Summary

      • Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

        FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
      • Fields inherited from interface org.eclipse.jetty.util.component.Dumpable

        KEY
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ContextHandler addContext​(java.lang.String contextPath, java.lang.String resourceBase)
      Add a context handler.
      protected void doStart()  
      java.lang.Class<?> getContextClass()  
      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 context paths.
      void setContextClass​(java.lang.Class<? extends ContextHandler> contextClass)  
      void setHandlers​(Handler[] handlers)  
      • Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle

        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
      • Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

        addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.eclipse.jetty.util.component.Dumpable

        dumpSelf
      • Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle

        addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
    • Constructor Detail

      • ContextHandlerCollection

        public ContextHandlerCollection()
      • ContextHandlerCollection

        public ContextHandlerCollection​(ContextHandler... contexts)
    • Method Detail

      • mapContexts

        @ManagedOperation("update the mapping of context path to context")
        public void mapContexts()
        Remap the context paths.
      • doStart

        protected void doStart()
                        throws java.lang.Exception
        Overrides:
        doStart in class AbstractHandler
        Throws:
        java.lang.Exception
      • addContext

        public ContextHandler addContext​(java.lang.String contextPath,
                                         java.lang.String resourceBase)
        Add a context handler.
        Parameters:
        contextPath - The context path to add
        resourceBase - the base (root) Resource
        Returns:
        the ContextHandler just added
      • getContextClass

        public java.lang.Class<?> getContextClass()
        Returns:
        The class to use to add new Contexts
      • setContextClass

        public void setContextClass​(java.lang.Class<? extends ContextHandler> contextClass)
        Parameters:
        contextClass - The class to use to add new Contexts