Package org.glassfish.grizzly.servlet
Class ServletHandler
java.lang.Object
org.glassfish.grizzly.http.server.HttpHandler
org.glassfish.grizzly.servlet.ServletHandler
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 Stringprotected Servlet -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidConfigure theWebappContextandServletConfigImplvoidcustomizeErrorPage(Response response, String message, int errorCode, Throwable t) Customize the error page returned to the client.voiddestroy()Destroy this Servlet and its associatedServletContextListenerprotected voiddoServletService(Request request, 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(Request request) getName()Get the HttpHandler name.protected WebappContextReturn theServletinstance used by thisServletHandlerprotected StringOverrides default (JSESSIONID) session cookie name.protected SessionManagergetSessionManager(Request request) protected voidLoad aServletinstance.protected booleansendAcknowledgment(Request request, 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.voidThis method should contain the logic for any HTTP extension to the Grizzly HTTP web server.voidsetClassLoader(ClassLoader classLoader) voidsetContextPath(String contextPath) Programmatically set the context path of the Servlet.protected voidsetDispatcherHelper(DispatcherHelper dispatcherHelper) voidsetExpectationHandler(ExpectationHandler expectationHandler) Set theExpectationHandlerresponsible for processing Expect: header (for example "Expect: 100-Continue").protected voidsetFilterChainFactory(FilterChainFactory filterChainFactory) protected voidsetPathData(Request from, HttpServletRequestImpl to) protected voidsetServletClass(Class<? extends Servlet> servletClass) protected voidsetServletClassName(String servletClassName) protected voidsetServletInstance(Servlet servletInstance) Set theServletinstance used by thisServletHandlerprotected voidsetSessionManager(SessionManager sessionManager) Set theSessionManagerinstance used by thisServletHandlervoidstart()Called when theHttpHandler's container is started by invokingHttpServer.start().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
-
properties
Holder for our configured properties. -
initialize
protected boolean initializeInitialize theServletContext -
classLoader
-
expectationHandler
-
filterChainFactory
-
-
Constructor Details
-
ServletHandler
-
-
Method Details
-
start
public void start()Called when theHttpHandler's container is started by invokingHttpServer.start(). By default, it does nothing.- Overrides:
startin classHttpHandler
-
sendAcknowledgment
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 classHttpHandler- Parameters:
request- theRequest.response- theResponse.- Returns:
trueif request processing should continue after acknowledgment of the expectation, otherwise returnfalse.- Throws:
IOException- if an error occurs sending the acknowledgment.
-
service
This method should contain the logic for any HTTP extension to the Grizzly HTTP web server.- Specified by:
servicein classHttpHandler- Parameters:
request- TheRequestresponse- TheResponse- Throws:
Exception
-
doServletService
-
getFilterChain
-
setPathData
-
customizeErrorPage
Customize the error page returned to the client.- Parameters:
response- theResponsemessage- the HTTP error messageerrorCode- the error code.
-
loadServlet
Load aServletinstance.- Throws:
ServletException- If failed toServlet.init(jakarta.servlet.ServletConfig).
-
configureServletEnv
Configure theWebappContextandServletConfigImpl- Throws:
ServletException- Error while configuringServlet.
-
getServletInstance
Return theServletinstance used by thisServletHandler- Returns:
Servletinstance.
-
setServletInstance
Set theServletinstance used by thisServletHandler- Parameters:
servletInstance- an instance of Servlet.
-
setServletClassName
-
setServletClass
-
setSessionManager
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:
-
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 classHttpHandler
-
getServletCtx
-
getClassLoader
-
setClassLoader
-
getServletConfig
-
getName
Description copied from class:HttpHandlerGet the HttpHandler name.- Overrides:
getNamein classHttpHandler- Returns:
- the HttpHandler name.
-
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
- Overrides:
setDispatcherHelperin classHttpHandler
-
setFilterChainFactory
-
getSessionCookieName
Overrides default (JSESSIONID) session cookie name.- Overrides:
getSessionCookieNamein classHttpHandler- Returns:
- the session cookie name
-
getSessionManager
- Overrides:
getSessionManagerin classHttpHandler- Parameters:
request-Request- Returns:
- Servlet-aware
SessionManager
-