Package org.glassfish.grizzly.servlet
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 Summary
FieldsModifier and TypeFieldDescriptionprotected ClassLoaderprotected ExpectationHandlerprotected FilterChainFactoryprotected booleanInitialize theServletContextHolder for our configured properties.protected Class<? extends javax.servlet.Servlet>protected Stringprotected javax.servlet.Servlet -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidConfigure theWebappContextandServletConfigImplvoidcustomizeErrorPage(org.glassfish.grizzly.http.server.Response response, String message, int errorCode, Throwable t) Customize the error page returned to the client.voiddestroy()Destroy this Servlet and its associatedServletContextListenerprotected voiddoServletService(org.glassfish.grizzly.http.server.Request request, org.glassfish.grizzly.http.server.Response response) Returns the portion of the request URI that indicates the context of the request.Get theExpectationHandlerresponsible for processing Expect: header (for example "Expect: 100-Continue").protected FilterChainInvokergetFilterChain(org.glassfish.grizzly.http.server.Request request) getName()protected WebappContextjavax.servlet.ServletReturn theServletinstance used by thisServletHandlerprotected StringOverrides default (JSESSIONID) session cookie name.protected org.glassfish.grizzly.http.server.SessionManagergetSessionManager(org.glassfish.grizzly.http.server.Request request) protected voidLoad aServletinstance.protected booleansendAcknowledgment(org.glassfish.grizzly.http.server.Request request, org.glassfish.grizzly.http.server.Response response) Override parent'sHttpHandler.sendAcknowledgment(org.glassfish.grizzly.http.server.Request, org.glassfish.grizzly.http.server.Response)to letExpectationHandler(if one is registered) process the expectation.voidservice(org.glassfish.grizzly.http.server.Request request, org.glassfish.grizzly.http.server.Response response) voidsetClassLoader(ClassLoader classLoader) voidsetContextPath(String contextPath) Programmatically set the context path of the Servlet.protected voidsetDispatcherHelper(org.glassfish.grizzly.http.server.util.DispatcherHelper dispatcherHelper) voidsetExpectationHandler(ExpectationHandler expectationHandler) Set theExpectationHandlerresponsible for processing Expect: header (for example "Expect: 100-Continue").protected voidsetFilterChainFactory(FilterChainFactory filterChainFactory) protected voidsetPathData(org.glassfish.grizzly.http.server.Request from, HttpServletRequestImpl to) protected voidsetServletClass(Class<? extends javax.servlet.Servlet> servletClass) protected voidsetServletClassName(String servletClassName) protected voidsetServletInstance(javax.servlet.Servlet servletInstance) Set theServletinstance used by thisServletHandlerprotected voidsetSessionManager(org.glassfish.grizzly.http.server.SessionManager sessionManager) Set theSessionManagerinstance used by thisServletHandlervoidstart()Methods inherited from class org.glassfish.grizzly.http.server.HttpHandler
getErrorPageGenerator, getRequestExecutorProvider, getRequestURIEncoding, isAllowCustomStatusMessage, isAllowEncodedSlash, setAllowCustomStatusMessage, setAllowEncodedSlash, setDecodeUrl, setRequestURIEncoding, setRequestURIEncoding, updatePaths
-
Field Details
-
servletClassName
-
servletClass
-
servletInstance
protected volatile javax.servlet.Servlet servletInstance -
properties
Holder for our configured properties. -
initialize
protected boolean initializeInitialize theServletContext -
classLoader
-
expectationHandler
-
filterChainFactory
-
-
Constructor Details
-
ServletHandler
-
-
Method Details
-
start
public void start()- Overrides:
startin classorg.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'sHttpHandler.sendAcknowledgment(org.glassfish.grizzly.http.server.Request, org.glassfish.grizzly.http.server.Response)to letExpectationHandler(if one is registered) process the expectation.- Overrides:
sendAcknowledgmentin classorg.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:
servicein classorg.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
-
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- theResponsemessage- the HTTP error messageerrorCode- the error code.
-
loadServlet
protected void loadServlet() throws javax.servlet.ServletExceptionLoad aServletinstance.- Throws:
javax.servlet.ServletException- If failed toServlet.init(javax.servlet.ServletConfig).
-
configureServletEnv
protected void configureServletEnv() throws javax.servlet.ServletExceptionConfigure theWebappContextandServletConfigImpl- Throws:
javax.servlet.ServletException- Error while configuringServlet.
-
getServletInstance
public javax.servlet.Servlet getServletInstance()Return theServletinstance used by thisServletHandler- Returns:
Servletinstance.
-
setServletInstance
protected void setServletInstance(javax.servlet.Servlet servletInstance) Set theServletinstance used by thisServletHandler- Parameters:
servletInstance- an instance of Servlet.
-
setServletClassName
-
setServletClass
-
setSessionManager
protected void setSessionManager(org.glassfish.grizzly.http.server.SessionManager sessionManager) Set theSessionManagerinstance used by thisServletHandler- Parameters:
sessionManager- an implementation of SessionManager.
-
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 byServletContext.getContextPath()should be considered as the prime or preferred context path of the application.- Returns:
- a
Stringspecifying the portion of the request URI that indicates the context of the request - See Also:
-
ServletContext.getContextPath()
-
setContextPath
Programmatically set the context path of the Servlet.- Parameters:
contextPath- Context path.
-
destroy
public void destroy()Destroy this Servlet and its associatedServletContextListener- Overrides:
destroyin classorg.glassfish.grizzly.http.server.HttpHandler
-
getServletCtx
-
getClassLoader
-
setClassLoader
-
getServletConfig
-
getName
- Overrides:
getNamein classorg.glassfish.grizzly.http.server.HttpHandler
-
getExpectationHandler
Get theExpectationHandlerresponsible for processing Expect: header (for example "Expect: 100-Continue").- Returns:
- the
ExpectationHandlerresponsible for processing Expect: header (for example "Expect: 100-Continue").
-
setExpectationHandler
Set theExpectationHandlerresponsible for processing Expect: header (for example "Expect: 100-Continue").- Parameters:
expectationHandler- theExpectationHandlerresponsible for processing Expect: header (for example "Expect: 100-Continue").
-
setDispatcherHelper
protected void setDispatcherHelper(org.glassfish.grizzly.http.server.util.DispatcherHelper dispatcherHelper) - Overrides:
setDispatcherHelperin classorg.glassfish.grizzly.http.server.HttpHandler
-
setFilterChainFactory
-
getSessionCookieName
Overrides default (JSESSIONID) session cookie name.- Overrides:
getSessionCookieNamein classorg.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:
getSessionManagerin classorg.glassfish.grizzly.http.server.HttpHandler- Returns:
- Servlet-aware
SessionManager
-