|
||||||||||
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.
Field Summary | |
---|---|
static int |
ADAPTER_NOTES
|
protected static boolean |
ALLOW_BACKSLASH
|
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 | |
---|---|
GrizzlyAdapter()
|
|
GrizzlyAdapter(String publicDirectory)
|
Method Summary | |
---|---|
abstract void |
afterService(GrizzlyRequest request,
GrizzlyResponse response)
This method should contains the logic for any http extension to the Grizzly HTTP Webserver. |
void |
afterService(Request req,
Response res)
Finish the response and recycle the request/response tokens. |
protected void |
convertMB(MessageBytes mb)
Character conversion of the a US-ASCII MessageBytes. |
protected void |
convertURI(MessageBytes uri,
GrizzlyRequest request)
|
protected static void |
copyBytes(byte[] b,
int dest,
int src,
int len)
Copy an array of bytes to a different position. |
boolean |
isHandleStaticResources()
Return true if this class should handle static resources. |
protected void |
log(String message)
Log a message on the Logger associated with our Container (if any) |
protected void |
log(String message,
Throwable throwable)
Log a message on the Logger associated with our Container (if any) |
static boolean |
normalize(MessageBytes uriMB)
Normalize URI. |
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 |
setHandleStaticResources(boolean handleStaticResources)
Enable static resource handling. |
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 |
Field Detail |
---|
public static final int ADAPTER_NOTES
protected static final boolean ALLOW_BACKSLASH
Constructor Detail |
---|
public GrizzlyAdapter()
public GrizzlyAdapter(String publicDirectory)
Method Detail |
---|
public 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
- res
-
Exception
public abstract void service(GrizzlyRequest request, GrizzlyResponse response)
public abstract void afterService(GrizzlyRequest request, GrizzlyResponse response) throws Exception
Exception
public void afterService(Request req, Response res) throws Exception
Adapter
afterService
in interface Adapter
afterService
in class StaticResourcesAdapter
Exception
protected void convertURI(MessageBytes uri, GrizzlyRequest request) throws Exception
Exception
public static boolean normalize(MessageBytes uriMB)
This method normalizes "\", "//", "/./" and "/../". This method will return false when trying to go above the root, or if the URI contains a null byte.
uriMB
- URI to be normalizedprotected static void copyBytes(byte[] b, int dest, int src, int len)
protected void log(String message)
message
- Message to be loggedprotected void log(String message, Throwable throwable)
message
- Message to be loggedthrowable
- Associated exceptionprotected void convertMB(MessageBytes mb)
public boolean isHandleStaticResources()
public void setHandleStaticResources(boolean handleStaticResources)
handleStaticResources
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |