Class HttpHandlerChain
- java.lang.Object
-
- org.glassfish.grizzly.http.server.HttpHandler
-
- org.glassfish.grizzly.http.server.HttpHandlerChain
-
- All Implemented Interfaces:
JmxEventListener
public class HttpHandlerChain extends HttpHandler implements JmxEventListener
The HttpHandlerChain class allows the invocation of multipleHttpHandlers every time a new HTTP request is ready to be handled. Requests are mapped to their associatedHttpHandlerat runtime using the mapping information configured when invoking the(org.glassfish.grizzly.http.server.HttpHandler, java.lang.String[])- Author:
- Jeanfrancois Arcand
-
-
Constructor Summary
Constructors Constructor Description HttpHandlerChain(HttpServer httpServer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddHandler(HttpHandler httpHandler, String[] mappings)Add aHttpHandlerand its associated array of mapping.voidaddHandler(HttpHandler httpHandler, HttpHandlerRegistration[] mappings)Add aHttpHandlerand its associated array of mapping.voiddestroy()Invoked when theHttpServerand may be overridden by custom implementations to perform implementation specific resource reclaimation tasks.voidjmxDisabled()Invoked when JMX has been disabled.voidjmxEnabled()Invoked when JMX has been enabled.voidremoveAllHttpHandlers()booleanremoveHttpHandler(HttpHandler httpHandler)Remove aHttpHandlervoidservice(Request request, Response response)Map theRequestto the properHttpHandlervoidstart()Called when theHttpHandler's container is started by invokingHttpServer.start().-
Methods inherited from class org.glassfish.grizzly.http.server.HttpHandler
getErrorPageGenerator, getName, getRequestExecutorProvider, getRequestURIEncoding, getSessionCookieName, getSessionManager, isAllowCustomStatusMessage, isAllowEncodedSlash, sendAcknowledgment, setAllowCustomStatusMessage, setAllowEncodedSlash, setDecodeUrl, setDispatcherHelper, setRequestURIEncoding, setRequestURIEncoding, updatePaths
-
-
-
-
Constructor Detail
-
HttpHandlerChain
public HttpHandlerChain(HttpServer httpServer)
-
-
Method Detail
-
jmxEnabled
public void jmxEnabled()
Description copied from interface:JmxEventListenerInvoked when JMX has been enabled.- Specified by:
jmxEnabledin interfaceJmxEventListener- See Also:
ServerConfiguration.setJmxEnabled(boolean)
-
jmxDisabled
public void jmxDisabled()
Description copied from interface:JmxEventListenerInvoked when JMX has been disabled.- Specified by:
jmxDisabledin interfaceJmxEventListener- See Also:
ServerConfiguration.setJmxEnabled(boolean)
-
service
public void service(Request request, Response response) throws Exception
Map theRequestto the properHttpHandler- Specified by:
servicein classHttpHandler- Parameters:
request- TheRequestresponse- TheResponse- Throws:
Exception
-
addHandler
public void addHandler(HttpHandler httpHandler, String[] mappings)
Add aHttpHandlerand its associated array of mapping. The mapping data will be used to map incoming request to its associatedHttpHandler.- Parameters:
httpHandler-HttpHandlerinstancemappings- an array of mapping.
-
addHandler
public void addHandler(HttpHandler httpHandler, HttpHandlerRegistration[] mappings)
Add aHttpHandlerand its associated array of mapping. The mapping data will be used to map incoming request to its associatedHttpHandler.- Parameters:
httpHandler-HttpHandlerinstancemappings- an array of mapping.
-
removeHttpHandler
public boolean removeHttpHandler(HttpHandler httpHandler)
Remove aHttpHandler- Parameters:
httpHandler-HttpHandlerto remove- Returns:
- true if removed
-
removeAllHttpHandlers
public void removeAllHttpHandlers()
-
start
public void start()
Description copied from class:HttpHandlerCalled when theHttpHandler's container is started by invokingHttpServer.start(). By default, it does nothing.- Overrides:
startin classHttpHandler
-
destroy
public void destroy()
Description copied from class:HttpHandlerInvoked when theHttpServerand may be overridden by custom implementations to perform implementation specific resource reclaimation tasks. By default, this method does nothing.- Overrides:
destroyin classHttpHandler
-
-