org.glassfish.grizzly.http.server
Class HttpServiceChain

java.lang.Object
  extended by org.glassfish.grizzly.http.server.HttpRequestProcessor
      extended by org.glassfish.grizzly.http.server.HttpServiceChain
All Implemented Interfaces:
JmxEventListener

public class HttpServiceChain
extends HttpRequestProcessor
implements JmxEventListener

The HttpServiceChain class allows the invocation of multiple HttpRequestProcessors every time a new HTTP request is ready to be handled. Requests are mapped to their associated HttpRequestProcessor at runtime using the mapping information configured when invoking the (org.glassfish.grizzly.http.server.HttpService, java.lang.String[]) Note: This class is NOT thread-safe, so make sure synchronization is performed when dynamically adding and removing HttpRequestProcessor

Author:
Jeanfrancois Arcand

Constructor Summary
HttpServiceChain(HttpServer httpServer)
           
 
Method Summary
 void addService(HttpRequestProcessor httpService, String[] mappings)
          Add a HttpRequestProcessor and its associated array of mapping.
 void destroy()
          Invoked when the HttpServer and may be overridden by custom implementations to perform implementation specific resource reclaimation tasks.
 void jmxDisabled()
          Invoked when JMX has been disabled.
 void jmxEnabled()
          Invoked when JMX has been enabled.
 void removeAllHttpServices()
           
 boolean removeHttpService(HttpRequestProcessor httpService)
          Remove a HttpRequestProcessor
 void service(Request request, Response response)
          Map the Request to the proper HttpRequestProcessor
 void start()
          Called when the HttpRequestProcessor's container is started by invoking HttpServer.start().
 
Methods inherited from class org.glassfish.grizzly.http.server.HttpRequestProcessor
customizedErrorPage, doService, getRequestURIEncoding, isAllowCustomStatusMessage, isAllowEncodedSlash, sendAcknowledgment, setAllowCustomStatusMessage, setAllowEncodedSlash, setDecodeUrl, setRequestURIEncoding, setRequestURIEncoding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpServiceChain

public HttpServiceChain(HttpServer httpServer)
Method Detail

jmxEnabled

public void jmxEnabled()
Description copied from interface: JmxEventListener
Invoked when JMX has been enabled.

Specified by:
jmxEnabled in interface JmxEventListener
See Also:
ServerConfiguration.setJmxEnabled(boolean)

jmxDisabled

public void jmxDisabled()
Description copied from interface: JmxEventListener
Invoked when JMX has been disabled.

Specified by:
jmxDisabled in interface JmxEventListener
See Also:
ServerConfiguration.setJmxEnabled(boolean)

start

public void start()
Description copied from class: HttpRequestProcessor
Called when the HttpRequestProcessor's container is started by invoking HttpServer.start(). By default, it does nothing.

Overrides:
start in class HttpRequestProcessor

service

public void service(Request request,
                    Response response)
             throws Exception
Map the Request to the proper HttpRequestProcessor

Specified by:
service in class HttpRequestProcessor
Parameters:
request - The Request
response - The Response
Throws:
Exception

addService

public void addService(HttpRequestProcessor httpService,
                       String[] mappings)
Add a HttpRequestProcessor and its associated array of mapping. The mapping data will be used to map incoming request to its associated HttpRequestProcessor.

Parameters:
httpService - HttpRequestProcessor instance
mappings - an array of mapping.

destroy

public void destroy()
Description copied from class: HttpRequestProcessor
Invoked when the HttpServer and may be overridden by custom implementations to perform implementation specific resource reclaimation tasks. By default, this method does nothing.

Overrides:
destroy in class HttpRequestProcessor

removeHttpService

public boolean removeHttpService(HttpRequestProcessor httpService)
Remove a HttpRequestProcessor

Returns:
true if removed

removeAllHttpServices

public void removeAllHttpServices()


Copyright © 2010 Oracle Corpration. All Rights Reserved.