|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.grizzly.tcp.StaticResourcesAdapter
com.sun.grizzly.tcp.http11.GrizzlyAdapter
public abstract class GrizzlyAdapter
Base class to use when GrizzlyRequest/Response/InputStream/OutputStream
are needed to implement a customized HTTP container/extendion to the
http module. The ServletAdapter
demonstrate and easy and powerfull
way of how to extend this class.
The GrizzlyAdapter
provides developpers with a simple and
consistent mechanism for extending the functionality of the HTTP WebServer and for bridging existing
http based technology like JRuby-on-Rail, Servlet, Bayeux Protocol or any
http based protocol.
Field Summary | |
---|---|
protected static int |
ADAPTER_NOTES
|
protected static boolean |
ALLOW_BACKSLASH
|
protected boolean |
chunkingDisabled
|
Fields inherited from class com.sun.grizzly.tcp.StaticResourcesAdapter |
---|
cache, commitErrorResponse, fileFolders, logger, resourcesContextPath |
Constructor Summary | |
---|---|
GrizzlyAdapter()
|
|
GrizzlyAdapter(String publicDirectory)
Create a new instance which will look for static pages located under publicDirectory folder. |
Method Summary | |
---|---|
void |
afterService(GrizzlyRequest request,
GrizzlyResponse response)
Once the service(com.sun.grizzly.tcp.Request, com.sun.grizzly.tcp.Response) method has been execyuted, the container will
call this method to allow any extension to clean up there associated
GrizzlyRequest and GrizzlyResponse . |
void |
afterService(Request req,
Response res)
Clean up the Request and Response object, and commit the
response, and then invoke the afterService(com.sun.grizzly.tcp.http11.GrizzlyRequest, com.sun.grizzly.tcp.http11.GrizzlyResponse) method to allow extension
of this class to clean their own objects. |
void |
destroy()
Invoked when the GrizzlyWebServer or SelectorThread
is stopped or removed. |
boolean |
isAllowEncodedSlash()
Is http url request allowed to contains encoded slash. |
boolean |
isDecodeURL()
Should this class decode the URL |
boolean |
isHandleStaticResources()
Return true if this class should handle static resources. |
abstract void |
service(GrizzlyRequest request,
GrizzlyResponse response)
This method should contains the logic for any http extension to the Grizzly HTTP Webserver. |
void |
service(Request req,
Response res)
Wrap a Request and Response with associated high level
classes like GrizzlyRequest and GrizzlyResponse . |
void |
setAllowEncodedSlash(boolean allowEncodedSlash)
When true, url that contains encoded slash will be allowed. |
protected void |
setDecodeUrl(boolean decodeURL)
Should this class decode the URL |
void |
setHandleStaticResources(boolean handleStaticResources)
Enable static resource handling. |
void |
start()
Called when the GrizzlyAdapter 's container is started by invoking
GrizzlyWebServer#start or when . |
Methods inherited from class com.sun.grizzly.tcp.StaticResourcesAdapter |
---|
addRootFolder, customizedErrorPage, getDefaultContentType, getResourcesContextPath, getRootFolder, getRootFolders, initWebDir, isUseSendFile, service, setDefaultContentType, setLogger, setResourcesContextPath, setRootFolder, setUseSendFile |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int ADAPTER_NOTES
protected static final boolean ALLOW_BACKSLASH
protected boolean chunkingDisabled
Constructor Detail |
---|
public GrizzlyAdapter()
public GrizzlyAdapter(String publicDirectory)
publicDirectory
- the folder where the static resource are located.Method Detail |
---|
public final void service(Request req, Response res) throws Exception
Request
and Response
with associated high level
classes like GrizzlyRequest
and GrizzlyResponse
. The later
objects offer more high level API like GrizzlyInputStream
,
GrizzlyRead
etc.
service
in interface Adapter
service
in class StaticResourcesAdapter
req
- the Request
res
- the Response
Exception
public abstract void service(GrizzlyRequest request, GrizzlyResponse response) throws Exception
request
- The GrizzlyRequest
response
- The GrizzlyResponse
Exception
public void afterService(GrizzlyRequest request, GrizzlyResponse response) throws Exception
service(com.sun.grizzly.tcp.Request, com.sun.grizzly.tcp.Response)
method has been execyuted, the container will
call this method to allow any extension to clean up there associated
GrizzlyRequest
and GrizzlyResponse
.
request
- The GrizzlyRequest
response
- The GrizzlyResponse
Exception
public final void afterService(Request req, Response res) throws Exception
Request
and Response
object, and commit the
response, and then invoke the afterService(com.sun.grizzly.tcp.http11.GrizzlyRequest, com.sun.grizzly.tcp.http11.GrizzlyResponse)
method to allow extension
of this class to clean their own objects.
afterService
in interface Adapter
afterService
in class StaticResourcesAdapter
req
- the Request
res
- the Response
Exception
public void start()
GrizzlyAdapter
's container is started by invoking
GrizzlyWebServer#start
or when . By default,
it does nothing.
public void destroy()
GrizzlyWebServer
or SelectorThread
is stopped or removed. By default, this method does nothing. Just override
the method if you need to clean some resource.
public boolean isHandleStaticResources()
public void setHandleStaticResources(boolean handleStaticResources)
handleStaticResources
- public boolean isAllowEncodedSlash()
public void setAllowEncodedSlash(boolean allowEncodedSlash)
allowEncodedSlash
- trueprotected void setDecodeUrl(boolean decodeURL)
public boolean isDecodeURL()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |