Class ServletContextHandler

    • Method Detail

      • addEventListener

        public void addEventListener​(java.util.EventListener listener)
        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:
        ServletContextListener, ServletContextAttributeListener, ServletRequestListener, ServletRequestAttributeListener
      • 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
      • startContext

        protected void startContext()
                             throws java.lang.Exception
        Finish constructing handlers and link them together.
        Overrides:
        startContext in class ContextHandler
        Throws:
        java.lang.Exception - if unable to start the context
        See Also:
        ContextHandler.startContext()
      • stopContext

        protected void stopContext()
                            throws java.lang.Exception
        Overrides:
        stopContext in class ContextHandler
        Throws:
        java.lang.Exception
      • addServlet

        public ServletHolder addServlet​(java.lang.String className,
                                        java.lang.String pathSpec)
        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​(java.lang.Class<? extends javax.servlet.Servlet> servlet,
                                        java.lang.String pathSpec)
        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,
                               java.lang.String pathSpec)
        Convenience method to add a servlet.
        Parameters:
        servlet - the servlet holder
        pathSpec - the path spec
      • addFilter

        public void addFilter​(FilterHolder holder,
                              java.lang.String pathSpec,
                              java.util.EnumSet<javax.servlet.DispatcherType> dispatches)
        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​(java.lang.Class<? extends javax.servlet.Filter> filterClass,
                                      java.lang.String pathSpec,
                                      java.util.EnumSet<javax.servlet.DispatcherType> dispatches)
        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​(java.lang.String filterClass,
                                      java.lang.String pathSpec,
                                      java.util.EnumSet<javax.servlet.DispatcherType> dispatches)
        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
      • dynamicHolderAdded

        protected javax.servlet.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​(javax.servlet.ServletRegistration.Dynamic registration,
                                                                  javax.servlet.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 constraints and thus will be unaffected by this call.
      • callContextInitialized

        public void callContextInitialized​(javax.servlet.ServletContextListener l,
                                           javax.servlet.ServletContextEvent e)
        Overrides:
        callContextInitialized in class ContextHandler
      • callContextDestroyed

        public void callContextDestroyed​(javax.servlet.ServletContextListener l,
                                         javax.servlet.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.
      • setGzipHandler

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

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

        public void insertHandler​(HandlerWrapper handler)
        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()
        The DecoratedObjectFactory for use by IoC containers (weld / spring / etc)
        Returns:
        The DecoratedObjectFactory
      • getServletContextHandler

        public static ServletContextHandler getServletContextHandler​(javax.servlet.ServletContext context)