Class ServletContextHandler

All Implemented Interfaces:
Handler, HandlerContainer, Attributes, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, Graceful, LifeCycle

@ManagedObject("Servlet Context Handler") @Deprecated(since="2021-05-27") public class ServletContextHandler extends ContextHandler
Deprecated.
The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.
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.

  • Field Details

  • Constructor Details

  • Method Details

    • addEventListener

      public void addEventListener(EventListener listener)
      Deprecated.
      Add EventListener Adds an EventListener to the list. @see org.eclipse.jetty.server.handler.ContextHandler#addEventListener(). Also adds any listeners that are session related to the SessionHandler.
      Overrides:
      addEventListener in class ContextHandler
      Parameters:
      listener - the listener to add
      See Also:
    • setHandler

      public void setHandler(Handler handler)
      Deprecated.
      Overrides:
      setHandler in class HandlerWrapper
      Parameters:
      handler - Set the Handler which should be wrapped.
    • getDefaultSecurityHandlerClass

      public Class<? extends SecurityHandler> getDefaultSecurityHandlerClass()
      Deprecated.
      Get the defaultSecurityHandlerClass.
      Returns:
      the defaultSecurityHandlerClass
    • setDefaultSecurityHandlerClass

      public void setDefaultSecurityHandlerClass(Class<? extends SecurityHandler> defaultSecurityHandlerClass)
      Deprecated.
      Set the defaultSecurityHandlerClass.
      Parameters:
      defaultSecurityHandlerClass - the defaultSecurityHandlerClass to set
    • getSecurityHandler

      @ManagedAttribute(value="context security handler", readonly=true) public SecurityHandler getSecurityHandler()
      Deprecated.
      Returns:
      Returns the securityHandler.
    • getServletHandler

      @ManagedAttribute(value="context servlet handler", readonly=true) public ServletHandler getServletHandler()
      Deprecated.
      Returns:
      Returns the servletHandler.
    • getSessionHandler

      @ManagedAttribute(value="context session handler", readonly=true) public SessionHandler getSessionHandler()
      Deprecated.
      Returns:
      Returns the sessionHandler.
    • getGzipHandler

      @ManagedAttribute(value="context gzip handler", readonly=true) public GzipHandler getGzipHandler()
      Deprecated.
      Returns:
      Returns the gzipHandler.
    • addServlet

      public ServletHolder addServlet(String className, String pathSpec)
      Deprecated.
      Convenience method to add a servlet.
      Parameters:
      className - the servlet class name
      pathSpec - the path spec to map servlet to
      Returns:
      the ServletHolder for the added servlet
    • addServlet

      public ServletHolder addServlet(Class<? extends Servlet> servlet, String pathSpec)
      Deprecated.
      Convenience method to add a servlet.
      Parameters:
      servlet - the servlet class
      pathSpec - the path spec to map servlet to
      Returns:
      the ServletHolder for the added servlet
    • addServlet

      public void addServlet(ServletHolder servlet, String pathSpec)
      Deprecated.
      Convenience method to add a servlet.
      Parameters:
      servlet - the servlet holder
      pathSpec - the path spec
    • addFilter

      public void addFilter(FilterHolder holder, String pathSpec, EnumSet<DispatcherType> dispatches)
      Deprecated.
      Convenience method to add a filter
      Parameters:
      holder - the filter holder
      pathSpec - the path spec
      dispatches - the dispatcher types for this filter
    • addFilter

      public FilterHolder addFilter(Class<? extends Filter> filterClass, String pathSpec, EnumSet<DispatcherType> dispatches)
      Deprecated.
      Convenience method to add a filter
      Parameters:
      filterClass - the filter class
      pathSpec - the path spec
      dispatches - the dispatcher types for this filter
      Returns:
      the FilterHolder that was created
    • addFilter

      public FilterHolder addFilter(String filterClass, String pathSpec, EnumSet<DispatcherType> dispatches)
      Deprecated.
      Convenience method to add a filter
      Parameters:
      filterClass - the filter class name
      pathSpec - the path spec
      dispatches - the dispatcher types for this filter
      Returns:
      the FilterHolder that was created
    • setServletSecurity

      public Set<String> setServletSecurity(ServletRegistration.Dynamic registration, ServletSecurityElement servletSecurityElement)
      Deprecated.
      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 constraints and thus will be unaffected by this call.
    • callContextInitialized

      public void callContextInitialized(ServletContextListener l, ServletContextEvent e)
      Deprecated.
    • callContextDestroyed

      public void callContextDestroyed(ServletContextListener l, ServletContextEvent e)
      Deprecated.
    • setSessionHandler

      public void setSessionHandler(SessionHandler sessionHandler)
      Deprecated.
      Parameters:
      sessionHandler - The sessionHandler to set.
    • setSecurityHandler

      public void setSecurityHandler(SecurityHandler securityHandler)
      Deprecated.
      Parameters:
      securityHandler - The SecurityHandler to set on this context.
    • setGzipHandler

      public void setGzipHandler(GzipHandler gzipHandler)
      Deprecated.
      Parameters:
      gzipHandler - The GzipHandler to set on this context.
    • setServletHandler

      public void setServletHandler(ServletHandler servletHandler)
      Deprecated.
      Parameters:
      servletHandler - The servletHandler to set.
    • insertHandler

      public void insertHandler(HandlerWrapper handler)
      Deprecated.
      Insert a HandlerWrapper before the first Session,Security or ServletHandler but after any other HandlerWrappers.
      Overrides:
      insertHandler in class HandlerWrapper
      Parameters:
      handler - the wrapper to insert
    • getObjectFactory

      public DecoratedObjectFactory getObjectFactory()
      Deprecated.
      The DecoratedObjectFactory for use by IoC containers (weld / spring / etc)
      Returns:
      The DecoratedObjectFactory
    • getDecorators

      Deprecated.
      use the DecoratedObjectFactory from getAttribute("org.eclipse.jetty.util.DecoratedObjectFactory") or getObjectFactory() instead
      Returns:
      The decorator list used to resource inject new Filters, Servlets and EventListeners
    • setDecorators

      @Deprecated public void setDecorators(List<ServletContextHandler.Decorator> decorators)
      Deprecated.
      use the DecoratedObjectFactory from getAttribute("org.eclipse.jetty.util.DecoratedObjectFactory") or getObjectFactory() instead
      Parameters:
      decorators - The list of ServletContextHandler.Decorators
    • addDecorator

      @Deprecated public void addDecorator(ServletContextHandler.Decorator decorator)
      Deprecated.
      use the DecoratedObjectFactory from getAttribute("org.eclipse.jetty.util.DecoratedObjectFactory") or getObjectFactory() instead
      Parameters:
      decorator - The decorator to add
    • getServletContextHandler

      public static ServletContextHandler getServletContextHandler(ServletContext context)
      Deprecated.