com.sun.grizzly.container
Class GrizzletAdapter

java.lang.Object
  extended by com.sun.grizzly.tcp.StaticResourcesAdapter
      extended by com.sun.grizzly.container.GrizzletAdapter
All Implemented Interfaces:
Adapter

public class GrizzletAdapter
extends StaticResourcesAdapter
implements Adapter

Standalone Comet implementation. This class is used when Comet is enabled from the Grizzly standalone WebServer. This class is responsible for invoking the Grizzlet defined when starting the Grizzly WebServer.

Author:
Jeanfrancois Arcand

Field Summary
static int ADAPTER_NOTES
           
static int GRIZZLET
           
static int POST
           
 
Fields inherited from class com.sun.grizzly.tcp.StaticResourcesAdapter
commitErrorResponse, logger
 
Fields inherited from interface com.sun.grizzly.tcp.Adapter
CONNECTION_PROCESSING_COMPLETED, CONNECTION_PROCESSING_STARTED, REQUEST_PROCESSING_COMPLETED, REQUEST_PROCESSING_STARTED
 
Constructor Summary
GrizzletAdapter()
           
GrizzletAdapter(String cometContextName)
           
 
Method Summary
 void afterService(Request req, Response res)
          Finish the response and recycle the request/response tokens.
 String getCometContextName()
           
 Grizzlet getGrizzlet()
          Set the user defined Grizzlet implementation.
 void service(Request req, Response res)
          Route the request to the comet implementation.
 void setCometContextName(String cometContextName)
           
 void setGrizzlet(Grizzlet grizzlet)
          Return the user defined Grizzlet implementation.
 
Methods inherited from class com.sun.grizzly.tcp.StaticResourcesAdapter
customizedErrorPage, fireAdapterEvent, getLogger, getRootFolder, service, setLogger, setRootFolder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.grizzly.tcp.Adapter
fireAdapterEvent
 

Field Detail

ADAPTER_NOTES

public static final int ADAPTER_NOTES
See Also:
Constant Field Values

POST

public static final int POST
See Also:
Constant Field Values

GRIZZLET

public static final int GRIZZLET
See Also:
Constant Field Values
Constructor Detail

GrizzletAdapter

public GrizzletAdapter()

GrizzletAdapter

public GrizzletAdapter(String cometContextName)
Method Detail

service

public void service(Request req,
                    Response res)
             throws Exception
Route the request to the comet implementation. If the request point to a static file, delegate the call to the Grizzly WebServer implementation.

Specified by:
service in interface Adapter
Overrides:
service in class StaticResourcesAdapter
Throws:
Exception - if an error happens during handling of the request. Common errors are:
  • IOException if an input/output error occurs and we are processing an included servlet (otherwise it is swallowed and handled by the top level error handler mechanism)
  • ServletException if a servlet throws an exception and we are processing an included servlet (otherwise it is swallowed and handled by the top level error handler mechanism)
Tomcat should be able to handle and log any other exception ( including runtime exceptions )

afterService

public void afterService(Request req,
                         Response res)
                  throws Exception
Description copied from interface: Adapter
Finish the response and recycle the request/response tokens. Base on the connection header, the underlying socket transport will be closed

Specified by:
afterService in interface Adapter
Overrides:
afterService in class StaticResourcesAdapter
Throws:
Exception

getGrizzlet

public Grizzlet getGrizzlet()
Set the user defined Grizzlet implementation.


setGrizzlet

public void setGrizzlet(Grizzlet grizzlet)
Return the user defined Grizzlet implementation.


getCometContextName

public String getCometContextName()

setCometContextName

public void setCometContextName(String cometContextName)


Copyright © 2008 SUN Microsystems. All Rights Reserved.