Class ServletHandler

java.lang.Object
org.glassfish.grizzly.http.server.HttpHandler
org.glassfish.grizzly.servlet.ServletHandler

public class ServletHandler extends org.glassfish.grizzly.http.server.HttpHandler
HttpHandler implementation that provides an entry point for processing a Servlet request.
Author:
Jeanfrancois Arcand
  • Field Details

    • servletClassName

      protected String servletClassName
    • servletClass

      protected Class<? extends javax.servlet.Servlet> servletClass
    • servletInstance

      protected volatile javax.servlet.Servlet servletInstance
    • properties

      protected final Map<String,Object> properties
      Holder for our configured properties.
    • initialize

      protected boolean initialize
      Initialize the ServletContext
    • classLoader

      protected ClassLoader classLoader
    • expectationHandler

      protected ExpectationHandler expectationHandler
    • filterChainFactory

      protected FilterChainFactory filterChainFactory
  • Constructor Details

  • Method Details

    • start

      public void start()
      Overrides:
      start in class org.glassfish.grizzly.http.server.HttpHandler
    • sendAcknowledgment

      protected boolean sendAcknowledgment(org.glassfish.grizzly.http.server.Request request, org.glassfish.grizzly.http.server.Response response) throws IOException
      Override parent's HttpHandler.sendAcknowledgment(org.glassfish.grizzly.http.server.Request, org.glassfish.grizzly.http.server.Response) to let ExpectationHandler (if one is registered) process the expectation.
      Overrides:
      sendAcknowledgment in class org.glassfish.grizzly.http.server.HttpHandler
      Throws:
      IOException
    • service

      public void service(org.glassfish.grizzly.http.server.Request request, org.glassfish.grizzly.http.server.Response response) throws Exception
      Specified by:
      service in class org.glassfish.grizzly.http.server.HttpHandler
      Throws:
      Exception
    • doServletService

      protected void doServletService(org.glassfish.grizzly.http.server.Request request, org.glassfish.grizzly.http.server.Response response)
    • getFilterChain

      protected FilterChainInvoker getFilterChain(org.glassfish.grizzly.http.server.Request request)
    • setPathData

      protected void setPathData(org.glassfish.grizzly.http.server.Request from, HttpServletRequestImpl to)
    • customizeErrorPage

      public void customizeErrorPage(org.glassfish.grizzly.http.server.Response response, String message, int errorCode, Throwable t)
      Customize the error page returned to the client.
      Parameters:
      response - the Response
      message - the HTTP error message
      errorCode - the error code.
    • loadServlet

      protected void loadServlet() throws javax.servlet.ServletException
      Load a Servlet instance.
      Throws:
      javax.servlet.ServletException - If failed to Servlet.init(javax.servlet.ServletConfig).
    • configureServletEnv

      protected void configureServletEnv() throws javax.servlet.ServletException
      Throws:
      javax.servlet.ServletException - Error while configuring Servlet.
    • getServletInstance

      public javax.servlet.Servlet getServletInstance()
      Return the Servlet instance used by this ServletHandler
      Returns:
      Servlet instance.
    • setServletInstance

      protected void setServletInstance(javax.servlet.Servlet servletInstance)
      Set the Servlet instance used by this ServletHandler
      Parameters:
      servletInstance - an instance of Servlet.
    • setServletClassName

      protected void setServletClassName(String servletClassName)
    • setServletClass

      protected void setServletClass(Class<? extends javax.servlet.Servlet> servletClass)
    • setSessionManager

      protected void setSessionManager(org.glassfish.grizzly.http.server.SessionManager sessionManager)
      Set the SessionManager instance used by this ServletHandler
      Parameters:
      sessionManager - an implementation of SessionManager.
    • getContextPath

      public String getContextPath()
      Returns the portion of the request URI that indicates the context of the request. The context path always comes first in a request URI. The path starts with a "/" character but does not end with a "/" character. For servlets in the default (root) context, this method returns "". The container does not decode this string.

      It is possible that a servlet container may match a context by more than one context path. In such cases this method will return the actual context path used by the request and it may differ from the path returned by the ServletContext.getContextPath() method. The context path returned by ServletContext.getContextPath() should be considered as the prime or preferred context path of the application.

      Returns:
      a String specifying the portion of the request URI that indicates the context of the request
      See Also:
      • ServletContext.getContextPath()
    • setContextPath

      public void setContextPath(String contextPath)
      Programmatically set the context path of the Servlet.
      Parameters:
      contextPath - Context path.
    • destroy

      public void destroy()
      Destroy this Servlet and its associated ServletContextListener
      Overrides:
      destroy in class org.glassfish.grizzly.http.server.HttpHandler
    • getServletCtx

      protected WebappContext getServletCtx()
    • getClassLoader

      public ClassLoader getClassLoader()
    • setClassLoader

      public void setClassLoader(ClassLoader classLoader)
    • getServletConfig

      public ServletConfigImpl getServletConfig()
    • getName

      public String getName()
      Overrides:
      getName in class org.glassfish.grizzly.http.server.HttpHandler
    • getExpectationHandler

      public ExpectationHandler getExpectationHandler()
      Get the ExpectationHandler responsible for processing Expect: header (for example "Expect: 100-Continue").
      Returns:
      the ExpectationHandler responsible for processing Expect: header (for example "Expect: 100-Continue").
    • setExpectationHandler

      public void setExpectationHandler(ExpectationHandler expectationHandler)
      Set the ExpectationHandler responsible for processing Expect: header (for example "Expect: 100-Continue").
      Parameters:
      expectationHandler - the ExpectationHandler responsible for processing Expect: header (for example "Expect: 100-Continue").
    • setDispatcherHelper

      protected void setDispatcherHelper(org.glassfish.grizzly.http.server.util.DispatcherHelper dispatcherHelper)
      Overrides:
      setDispatcherHelper in class org.glassfish.grizzly.http.server.HttpHandler
    • setFilterChainFactory

      protected void setFilterChainFactory(FilterChainFactory filterChainFactory)
    • getSessionCookieName

      protected String getSessionCookieName()
      Overrides default (JSESSIONID) session cookie name.
      Overrides:
      getSessionCookieName in class org.glassfish.grizzly.http.server.HttpHandler
      Returns:
      the session cookie name
    • getSessionManager

      protected org.glassfish.grizzly.http.server.SessionManager getSessionManager(org.glassfish.grizzly.http.server.Request request)
      Overrides:
      getSessionManager in class org.glassfish.grizzly.http.server.HttpHandler
      Returns:
      Servlet-aware SessionManager