Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.jetty.servlet
Class ServletContextHandler

    java.lang.Object
      org.eclipse.jetty.util.component.AbstractLifeCycle
          org.eclipse.jetty.server.handler.AbstractHandler
              org.eclipse.jetty.server.handler.AbstractHandlerContainer
                  org.eclipse.jetty.server.handler.HandlerWrapper
                      org.eclipse.jetty.server.handler.ScopedHandler
                          org.eclipse.jetty.server.handler.ContextHandler
                              org.eclipse.jetty.servlet.ServletContextHandler

All Implemented Interfaces:
  Handler, HandlerContainer, Server.Graceful, Attributes, LifeCycle

Direct Known Subclasses:
  WebAppContext

    public class ServletContextHandler

extends ContextHandler

Servlet Context. This extension to the ContextHandler allows for simple construction of a context with ServletHandler and optionally session and security handlers, et.

       new ServletContext("/context",Context.SESSIONS|Context.NO_SECURITY);

This class should have been called ServletContext, but this would have cause confusion with `ServletContext`.

Nested Class Summary
`class` | `ServletContextHandler.Context`
`static interface` | `ServletContextHandler.Decorator` Interface to decorate loaded classes.

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

Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
`LifeCycle.Listener`

Field Summary
`protected java.util.List<ServletContextHandler.Decorator>` | `_decorators`
`protected java.lang.Class<? extends SecurityHandler>` | `_defaultSecurityHandlerClass`
`protected JspConfigDescriptor` | `_jspConfig`
`protected int` | `_options`
`protected java.lang.Object` | `_restrictedContextListeners`
`protected SecurityHandler` | `_securityHandler`
`protected ServletHandler` | `_servletHandler`
`protected SessionHandler` | `_sessionHandler`
`static int` | `NO_SECURITY`
`static int` | `NO_SESSIONS`
`static int` | `SECURITY`
`static int` | `SESSIONS`

Fields inherited from class org.eclipse.jetty.server.handler.ContextHandler
`_scontext, MANAGED_ATTRIBUTES`

Fields inherited from class org.eclipse.jetty.server.handler.ScopedHandler
`_nextScope, _outerScope`

Fields inherited from class org.eclipse.jetty.server.handler.HandlerWrapper
`_handler`

Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
`_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING`

Constructor Summary
`ServletContextHandler()`
`ServletContextHandler(HandlerContainer parent, SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler)`
`ServletContextHandler(HandlerContainer parent, java.lang.String contextPath)`
`ServletContextHandler(HandlerContainer parent, java.lang.String contextPath, boolean sessions, boolean security)`
`ServletContextHandler(HandlerContainer parent, java.lang.String contextPath, int options)`
`ServletContextHandler(HandlerContainer parent, java.lang.String contextPath, SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler)`
`ServletContextHandler(int options)`

Method Summary
`void` | `addDecorator(ServletContextHandler.Decorator decorator)`
`FilterHolder` | `addFilter(java.lang.Class<? extends Filter> filterClass, java.lang.String pathSpec, java.util.EnumSet<DispatcherType> dispatches)` convenience method to add a filter
`void` | `addFilter(FilterHolder holder, java.lang.String pathSpec, java.util.EnumSet<DispatcherType> dispatches)` conveniance method to add a filter
`FilterHolder` | `addFilter(java.lang.String filterClass, java.lang.String pathSpec, java.util.EnumSet<DispatcherType> dispatches)` convenience method to add a filter
`protected void` | `addRoles(java.lang.String... roleNames)` delegate for ServletContext.declareRole method
`ServletHolder` | `addServlet(java.lang.Class<? extends Servlet> servlet, java.lang.String pathSpec)` conveniance method to add a servlet.
`void` | `addServlet(ServletHolder servlet, java.lang.String pathSpec)` conveniance method to add a servlet.
`ServletHolder` | `addServlet(java.lang.String className, java.lang.String pathSpec)` conveniance method to add a servlet.
`void` | `callContextDestroyed(ServletContextListener l, ServletContextEvent e)`
`void` | `callContextInitialized(ServletContextListener l, ServletContextEvent e)`
`protected void` | `doStop()`
`protected ServletRegistration.Dynamic` | `dynamicHolderAdded(ServletHolder holder)` notification that a ServletRegistration has been created so we can track the annotations
`java.util.List<ServletContextHandler.Decorator>` | `getDecorators()`
`java.lang.Class<? extends SecurityHandler>` | `getDefaultSecurityHandlerClass()` Get the defaultSecurityHandlerClass.
`SecurityHandler` | `getSecurityHandler()`
`ServletHandler` | `getServletHandler()`
`SessionHandler` | `getSessionHandler()`
`boolean` | `isRestrictListeners()`
`protected SecurityHandler` | `newSecurityHandler()`
`protected ServletHandler` | `newServletHandler()`
`protected SessionHandler` | `newSessionHandler()`
`void` | `restrictEventListener(java.util.EventListener e)` Apply any necessary restrictions on a programmatically added listener.
`void` | `setDecorators(java.util.List<ServletContextHandler.Decorator> decorators)`
`void` | `setDefaultSecurityHandlerClass(java.lang.Class<? extends SecurityHandler> defaultSecurityHandlerClass)` Set the defaultSecurityHandlerClass.
`void` | `setRestrictListeners(boolean restrictListeners)`
`void` | `setSecurityHandler(SecurityHandler securityHandler)`
`void` | `setServletHandler(ServletHandler servletHandler)`
`java.util.Set<java.lang.String>` | `setServletSecurity(ServletRegistration.Dynamic registration, ServletSecurityElement servletSecurityElement)` Delegate for ServletRegistration.Dynamic.setServletSecurity method
`void` | `setSessionHandler(SessionHandler sessionHandler)`
`protected void` | `startContext()` Finish constructing handlers and link them together.

Methods inherited from class org.eclipse.jetty.server.handler.ContextHandler
`addEventListener, addLocaleEncoding, checkContext, checkManagedAttribute, clearAttributes, doHandle, doScope, doStart, dump, getAllowNullPathInfo, getAttribute, getAttributeNames, getAttributes, getBaseResource, getClassLoader, getClassPath, getConnectorNames, getContextPath, getCurrentContext, getDisplayName, getErrorHandler, getEventListeners, getInitParameter, getInitParameterNames, getInitParams, getLocaleEncoding, getLocaleEncoding, getLogger, getMaxFormContentSize, getMimeTypes, getResource, getResourceBase, getResourcePaths, getServletContext, getVirtualHosts, getWelcomeFiles, handle, isAliases, isAvailable, isCompactPath, isProtectedTarget, isShutdown, loadClass, newResource, newResource, removeAttribute, setAliases, setAllowNullPathInfo, setAttribute, setAttributes, setAvailable, setBaseResource, setClassLoader, setCompactPath, setConnectorNames, setContextPath, setDisplayName, setErrorHandler, setEventListeners, setLogger, setManagedAttribute, setMaxFormContentSize, setMimeTypes, setResourceBase, setServer, setShutdown, setVirtualHosts, setWelcomeFiles, toString`

Methods inherited from class org.eclipse.jetty.server.handler.ScopedHandler
`handle, never, nextHandle, nextScope`

Methods inherited from class org.eclipse.jetty.server.handler.HandlerWrapper
`expandChildren, getHandler, getHandlers, getNestedHandlerByClass, setHandler`

Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandlerContainer
`dumpHandlers, expandHandler, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass`

Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandler
`destroy, dump, dump, getServer`

Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
`addLifeCycleListener, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.eclipse.jetty.server.Handler
`destroy, getServer, handle`

Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle
`addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop`

Field Detail

### SESSIONS

    public static final int SESSIONS

See Also:
  Constant Field Values

### SECURITY

    public static final int SECURITY

See Also:
  Constant Field Values

### NO_SESSIONS

    public static final int NO_SESSIONS

See Also:
  Constant Field Values

### NO_SECURITY

    public static final int NO_SECURITY

See Also:
  Constant Field Values

### _decorators

    protected final java.util.List<ServletContextHandler.Decorator> _decorators

### _defaultSecurityHandlerClass

    protected java.lang.Class<? extends SecurityHandler> _defaultSecurityHandlerClass

### _sessionHandler

    protected SessionHandler _sessionHandler

### _securityHandler

    protected SecurityHandler _securityHandler

### _servletHandler

    protected ServletHandler _servletHandler

### _options

    protected int _options

### _jspConfig

    protected JspConfigDescriptor _jspConfig

### _restrictedContextListeners

    protected java.lang.Object _restrictedContextListeners

Constructor Detail

### ServletContextHandler

    public ServletContextHandler()

### ServletContextHandler

    public ServletContextHandler(int options)

### ServletContextHandler

    public ServletContextHandler(HandlerContainer parent,
                                 java.lang.String contextPath)

### ServletContextHandler

    public ServletContextHandler(HandlerContainer parent,
                                 java.lang.String contextPath,
                                 int options)

### ServletContextHandler

    public ServletContextHandler(HandlerContainer parent,
                                 java.lang.String contextPath,
                                 boolean sessions,
                                 boolean security)

### ServletContextHandler

    public ServletContextHandler(HandlerContainer parent,
                                 SessionHandler sessionHandler,
                                 SecurityHandler securityHandler,
                                 ServletHandler servletHandler,
                                 ErrorHandler errorHandler)

### ServletContextHandler

    public ServletContextHandler(HandlerContainer parent,
                                 java.lang.String contextPath,
                                 SessionHandler sessionHandler,
                                 SecurityHandler securityHandler,
                                 ServletHandler servletHandler,
                                 ErrorHandler errorHandler)

Method Detail

### doStop

    protected void doStop()
                   throws java.lang.Exception

  Overrides:
    `doStop` in class `ContextHandler`
  Throws:
    `java.lang.Exception`
  See Also:
    `ContextHandler.doStop()`

### getDefaultSecurityHandlerClass

    public java.lang.Class<? extends SecurityHandler> getDefaultSecurityHandlerClass()

  Get the defaultSecurityHandlerClass.

  Returns:
    the defaultSecurityHandlerClass

### setDefaultSecurityHandlerClass

    public void setDefaultSecurityHandlerClass(java.lang.Class<? extends SecurityHandler> defaultSecurityHandlerClass)

  Set the defaultSecurityHandlerClass.

  Parameters:
    `defaultSecurityHandlerClass` - the defaultSecurityHandlerClass to set

### newSessionHandler

    protected SessionHandler newSessionHandler()

### newSecurityHandler

    protected SecurityHandler newSecurityHandler()

### newServletHandler

    protected ServletHandler newServletHandler()

### startContext

    protected void startContext()
                         throws java.lang.Exception

  Finish constructing handlers and link them together.

  Overrides:
    `startContext` in class `ContextHandler`
  Throws:
    `java.lang.Exception`
  See Also:
    `ContextHandler.startContext()`

### getSecurityHandler

    public SecurityHandler getSecurityHandler()

  Returns:
    Returns the securityHandler.

### getServletHandler

    public ServletHandler getServletHandler()

  Returns:
    Returns the servletHandler.

### getSessionHandler

    public SessionHandler getSessionHandler()

  Returns:
    Returns the sessionHandler.

### addServlet

    public ServletHolder addServlet(java.lang.String className,
                                    java.lang.String pathSpec)

  conveniance method to add a servlet.

### addServlet

    public ServletHolder addServlet(java.lang.Class<? extends Servlet> servlet,
                                    java.lang.String pathSpec)

  conveniance method to add a servlet.

### addServlet

    public void addServlet(ServletHolder servlet,
                           java.lang.String pathSpec)

  conveniance method to add a servlet.

### addFilter

    public void addFilter(FilterHolder holder,
                          java.lang.String pathSpec,
                          java.util.EnumSet<DispatcherType> dispatches)

  conveniance method to add a filter

### addFilter

    public FilterHolder addFilter(java.lang.Class<? extends Filter> filterClass,
                                  java.lang.String pathSpec,
                                  java.util.EnumSet<DispatcherType> dispatches)

  convenience method to add a filter

### addFilter

    public FilterHolder addFilter(java.lang.String filterClass,
                                  java.lang.String pathSpec,
                                  java.util.EnumSet<DispatcherType> dispatches)

  convenience method to add a filter

### dynamicHolderAdded

    protected ServletRegistration.Dynamic dynamicHolderAdded(ServletHolder holder)

  notification that a ServletRegistration has been created so we can track the annotations

  Parameters:
    `holder` - new holder created through the api.
  Returns:
    the ServletRegistration.Dynamic

### addRoles

    protected void addRoles(java.lang.String... roleNames)

  delegate for ServletContext.declareRole method

  Parameters:
    `roleNames` - role names to add

### setServletSecurity

    public java.util.Set<java.lang.String> setServletSecurity(ServletRegistration.Dynamic registration,
                                                              ServletSecurityElement servletSecurityElement)

  Delegate for ServletRegistration.Dynamic.setServletSecurity method

  Parameters:
    `registration` - ServletRegistration.Dynamic instance that setServletSecurity was called on
    `servletSecurityElement` - new security info
  Returns:
    the set of exact URL mappings currently associated with the registration that are also present in the web.xml security constratins and thus will be unaffected by this call.

### restrictEventListener

    public void restrictEventListener(java.util.EventListener e)

  Description copied from class: `ContextHandler`
  Apply any necessary restrictions on a programmatically added listener. Superclasses should implement.

  Overrides:
    `restrictEventListener` in class `ContextHandler`

### isRestrictListeners

    public boolean isRestrictListeners()

### setRestrictListeners

    public void setRestrictListeners(boolean restrictListeners)

### callContextInitialized

    public void callContextInitialized(ServletContextListener l,
                                       ServletContextEvent e)

  Overrides:
    `callContextInitialized` in class `ContextHandler`

### callContextDestroyed

    public void callContextDestroyed(ServletContextListener l,
                                     ServletContextEvent e)

  Overrides:
    `callContextDestroyed` in class `ContextHandler`

### setSessionHandler

    public void setSessionHandler(SessionHandler sessionHandler)

  Parameters:
    `sessionHandler` - The sessionHandler to set.

### setSecurityHandler

    public void setSecurityHandler(SecurityHandler securityHandler)

  Parameters:
    `securityHandler` - The `SecurityHandler` to set on this context.

### setServletHandler

    public void setServletHandler(ServletHandler servletHandler)

  Parameters:
    `servletHandler` - The servletHandler to set.

### getDecorators

    public java.util.List<ServletContextHandler.Decorator> getDecorators()

  Returns:
    The decorator list used to resource inject new Filters, Servlets and EventListeners

### setDecorators

    public void setDecorators(java.util.List<ServletContextHandler.Decorator> decorators)

  Parameters:
    `decorators` - The lis of `ServletContextHandler.Decorator`s

### addDecorator

    public void addDecorator(ServletContextHandler.Decorator decorator)

  Parameters:
    `decorator` - The decorator to add

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1995-2010 Mort Bay Consulting. All Rights Reserved.