org.eclipse.jetty.servlet
类 ServletContextHandler

java.lang.Object
  继承者 org.eclipse.jetty.util.component.AbstractLifeCycle
      继承者 org.eclipse.jetty.util.component.AggregateLifeCycle
          继承者 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
所有已实现的接口:
Handler, HandlerContainer, Server.Graceful, Attributes, Destroyable, Dumpable, LifeCycle
直接已知子类:
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.


嵌套类摘要
 class ServletContextHandler.Context
           
static interface ServletContextHandler.Decorator
          Interface to decorate loaded classes.
static class ServletContextHandler.JspConfig
           
static class ServletContextHandler.JspPropertyGroup
           
static class ServletContextHandler.TagLib
           
 
从类 org.eclipse.jetty.server.handler.ContextHandler 继承的嵌套类/接口
ContextHandler.AliasCheck, ContextHandler.ApproveNonExistentDirectoryAliases, ContextHandler.ApprovePathPrefixAliases, ContextHandler.ApproveSameSuffixAliases
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的嵌套类/接口
AbstractLifeCycle.AbstractLifeCycleListener
 
从接口 org.eclipse.jetty.util.component.LifeCycle 继承的嵌套类/接口
LifeCycle.Listener
 
字段摘要
protected  List<ServletContextHandler.Decorator> _decorators
           
protected  Class<? extends SecurityHandler> _defaultSecurityHandlerClass
           
protected  JspConfigDescriptor _jspConfig
           
protected  int _options
           
protected  Object _restrictedContextListeners
           
protected  SecurityHandler _securityHandler
           
protected  ServletHandler _servletHandler
           
protected  SessionHandler _sessionHandler
           
protected  HandlerWrapper _wrapper
           
static int NO_SECURITY
           
static int NO_SESSIONS
           
static int SECURITY
           
static int SESSIONS
           
 
从类 org.eclipse.jetty.server.handler.ContextHandler 继承的字段
_scontext, MANAGED_ATTRIBUTES
 
从类 org.eclipse.jetty.server.handler.ScopedHandler 继承的字段
_nextScope, _outerScope
 
从类 org.eclipse.jetty.server.handler.HandlerWrapper 继承的字段
_handler
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的字段
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
 
构造方法摘要
ServletContextHandler()
           
ServletContextHandler(HandlerContainer parent, SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler)
           
ServletContextHandler(HandlerContainer parent, String contextPath)
           
ServletContextHandler(HandlerContainer parent, String contextPath, boolean sessions, boolean security)
           
ServletContextHandler(HandlerContainer parent, String contextPath, int options)
           
ServletContextHandler(HandlerContainer parent, String contextPath, SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler)
           
ServletContextHandler(int options)
           
 
方法摘要
 void addDecorator(ServletContextHandler.Decorator decorator)
           
 FilterHolder addFilter(Class<? extends Filter> filterClass, String pathSpec, EnumSet<DispatcherType> dispatches)
          convenience method to add a filter
 void addFilter(FilterHolder holder, String pathSpec, EnumSet<DispatcherType> dispatches)
          conveniance method to add a filter
 FilterHolder addFilter(String filterClass, String pathSpec, EnumSet<DispatcherType> dispatches)
          convenience method to add a filter
protected  void addRoles(String... roleNames)
          delegate for ServletContext.declareRole method
 ServletHolder addServlet(Class<? extends Servlet> servlet, String pathSpec)
          conveniance method to add a servlet.
 void addServlet(ServletHolder servlet, String pathSpec)
          conveniance method to add a servlet.
 ServletHolder addServlet(String className, String pathSpec)
          conveniance method to add a servlet.
 void callContextDestroyed(ServletContextListener l, ServletContextEvent e)
           
 void callContextInitialized(ServletContextListener l, ServletContextEvent e)
           
protected  void doStop()
          Stop the joined lifecycle beans in the reverse order they were added.
protected  ServletRegistration.Dynamic dynamicHolderAdded(ServletHolder holder)
          notification that a ServletRegistration has been created so we can track the annotations
 List<ServletContextHandler.Decorator> getDecorators()
           
 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(EventListener e)
          Apply any necessary restrictions on a programmatically added listener.
 void setDecorators(List<ServletContextHandler.Decorator> decorators)
           
 void setDefaultSecurityHandlerClass(Class<? extends SecurityHandler> defaultSecurityHandlerClass)
          Set the defaultSecurityHandlerClass.
 void setRestrictListeners(boolean restrictListeners)
           
 void setSecurityHandler(SecurityHandler securityHandler)
           
 void setServletHandler(ServletHandler servletHandler)
           
 Set<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.
 
从类 org.eclipse.jetty.server.handler.ContextHandler 继承的方法
addAliasCheck, addEventListener, addLocaleEncoding, addVirtualHosts, checkContext, checkManagedAttribute, clearAttributes, doHandle, doScope, doStart, dump, getAliasChecks, getAllowNullPathInfo, getAttribute, getAttributeNames, getAttributes, getBaseResource, getClassLoader, getClassPath, getConnectorNames, getContextPath, getCurrentContext, getDisplayName, getErrorHandler, getEventListeners, getInitParameter, getInitParameterNames, getInitParams, getLocaleEncoding, getLocaleEncoding, getLogger, getMaxFormContentSize, getMaxFormKeys, getMimeTypes, getProtectedTargets, getResource, getResourceBase, getResourcePaths, getServletContext, getVirtualHosts, getWelcomeFiles, handle, isAliases, isAvailable, isCompactPath, isProtectedTarget, isShutdown, loadClass, newResource, newResource, removeAttribute, removeVirtualHosts, setAliases, setAllowNullPathInfo, setAttribute, setAttributes, setAvailable, setBaseResource, setClassLoader, setCompactPath, setConnectorNames, setContextPath, setDisplayName, setErrorHandler, setEventListeners, setInitParameter, setLogger, setManagedAttribute, setMaxFormContentSize, setMaxFormKeys, setMimeTypes, setProtectedTargets, setResourceBase, setServer, setShutdown, setVirtualHosts, setWelcomeFiles, toString
 
从类 org.eclipse.jetty.server.handler.ScopedHandler 继承的方法
handle, never, nextHandle, nextScope
 
从类 org.eclipse.jetty.server.handler.HandlerWrapper 继承的方法
destroy, expandChildren, getHandler, getHandlers, getNestedHandlerByClass, setHandler
 
从类 org.eclipse.jetty.server.handler.AbstractHandlerContainer 继承的方法
expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass
 
从类 org.eclipse.jetty.server.handler.AbstractHandler 继承的方法
dumpThis, getServer
 
从类 org.eclipse.jetty.util.component.AggregateLifeCycle 继承的方法
addBean, addBean, contains, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, unmanage
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的方法
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
从接口 org.eclipse.jetty.server.Handler 继承的方法
destroy, getServer, handle
 
从接口 org.eclipse.jetty.util.component.LifeCycle 继承的方法
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 

字段详细信息

SESSIONS

public static final int SESSIONS
另请参见:
常量字段值

SECURITY

public static final int SECURITY
另请参见:
常量字段值

NO_SESSIONS

public static final int NO_SESSIONS
另请参见:
常量字段值

NO_SECURITY

public static final int NO_SECURITY
另请参见:
常量字段值

_decorators

protected final List<ServletContextHandler.Decorator> _decorators

_defaultSecurityHandlerClass

protected Class<? extends SecurityHandler> _defaultSecurityHandlerClass

_sessionHandler

protected SessionHandler _sessionHandler

_securityHandler

protected SecurityHandler _securityHandler

_servletHandler

protected ServletHandler _servletHandler

_wrapper

protected HandlerWrapper _wrapper

_options

protected int _options

_jspConfig

protected JspConfigDescriptor _jspConfig

_restrictedContextListeners

protected Object _restrictedContextListeners
构造方法详细信息

ServletContextHandler

public ServletContextHandler()

ServletContextHandler

public ServletContextHandler(int options)

ServletContextHandler

public ServletContextHandler(HandlerContainer parent,
                             String contextPath)

ServletContextHandler

public ServletContextHandler(HandlerContainer parent,
                             String contextPath,
                             int options)

ServletContextHandler

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

ServletContextHandler

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

ServletContextHandler

public ServletContextHandler(HandlerContainer parent,
                             String contextPath,
                             SessionHandler sessionHandler,
                             SecurityHandler securityHandler,
                             ServletHandler servletHandler,
                             ErrorHandler errorHandler)
方法详细信息

doStop

protected void doStop()
               throws Exception
从类 AggregateLifeCycle 复制的描述
Stop the joined lifecycle beans in the reverse order they were added.

覆盖:
ContextHandler 中的 doStop
抛出:
Exception
另请参见:
ContextHandler.doStop()

getDefaultSecurityHandlerClass

public Class<? extends SecurityHandler> getDefaultSecurityHandlerClass()
Get the defaultSecurityHandlerClass.

返回:
the defaultSecurityHandlerClass

setDefaultSecurityHandlerClass

public void setDefaultSecurityHandlerClass(Class<? extends SecurityHandler> defaultSecurityHandlerClass)
Set the defaultSecurityHandlerClass.

参数:
defaultSecurityHandlerClass - the defaultSecurityHandlerClass to set

newSessionHandler

protected SessionHandler newSessionHandler()

newSecurityHandler

protected SecurityHandler newSecurityHandler()

newServletHandler

protected ServletHandler newServletHandler()

startContext

protected void startContext()
                     throws Exception
Finish constructing handlers and link them together.

覆盖:
ContextHandler 中的 startContext
抛出:
Exception
另请参见:
ContextHandler.startContext()

getSecurityHandler

public SecurityHandler getSecurityHandler()
返回:
Returns the securityHandler.

getServletHandler

public ServletHandler getServletHandler()
返回:
Returns the servletHandler.

getSessionHandler

public SessionHandler getSessionHandler()
返回:
Returns the sessionHandler.

addServlet

public ServletHolder addServlet(String className,
                                String pathSpec)
conveniance method to add a servlet.


addServlet

public ServletHolder addServlet(Class<? extends Servlet> servlet,
                                String pathSpec)
conveniance method to add a servlet.


addServlet

public void addServlet(ServletHolder servlet,
                       String pathSpec)
conveniance method to add a servlet.


addFilter

public void addFilter(FilterHolder holder,
                      String pathSpec,
                      EnumSet<DispatcherType> dispatches)
conveniance method to add a filter


addFilter

public FilterHolder addFilter(Class<? extends Filter> filterClass,
                              String pathSpec,
                              EnumSet<DispatcherType> dispatches)
convenience method to add a filter


addFilter

public FilterHolder addFilter(String filterClass,
                              String pathSpec,
                              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

参数:
holder - new holder created through the api.
返回:
the ServletRegistration.Dynamic

addRoles

protected void addRoles(String... roleNames)
delegate for ServletContext.declareRole method

参数:
roleNames - role names to add

setServletSecurity

public Set<String> setServletSecurity(ServletRegistration.Dynamic registration,
                                      ServletSecurityElement servletSecurityElement)
Delegate for ServletRegistration.Dynamic.setServletSecurity method

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

restrictEventListener

public void restrictEventListener(EventListener e)
从类 ContextHandler 复制的描述
Apply any necessary restrictions on a programmatically added listener. Superclasses should implement.

覆盖:
ContextHandler 中的 restrictEventListener

isRestrictListeners

public boolean isRestrictListeners()

setRestrictListeners

public void setRestrictListeners(boolean restrictListeners)

callContextInitialized

public void callContextInitialized(ServletContextListener l,
                                   ServletContextEvent e)
覆盖:
ContextHandler 中的 callContextInitialized

callContextDestroyed

public void callContextDestroyed(ServletContextListener l,
                                 ServletContextEvent e)
覆盖:
ContextHandler 中的 callContextDestroyed

setSessionHandler

public void setSessionHandler(SessionHandler sessionHandler)
参数:
sessionHandler - The sessionHandler to set.

setSecurityHandler

public void setSecurityHandler(SecurityHandler securityHandler)
参数:
securityHandler - The SecurityHandler to set on this context.

setServletHandler

public void setServletHandler(ServletHandler servletHandler)
参数:
servletHandler - The servletHandler to set.

getDecorators

public List<ServletContextHandler.Decorator> getDecorators()
返回:
The decorator list used to resource inject new Filters, Servlets and EventListeners

setDecorators

public void setDecorators(List<ServletContextHandler.Decorator> decorators)
参数:
decorators - The lis of ServletContextHandler.Decorators

addDecorator

public void addDecorator(ServletContextHandler.Decorator decorator)
参数:
decorator - The decorator to add


Copyright © 2013. All Rights Reserved.