|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.grizzly.http.server.HttpHandler
public abstract class HttpHandler
Base class to use when Request/Response/InputStream/OutputStream
are needed to implement a customized HTTP container/extension to the
HTTP module.
The HttpHandler provides developers
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.
| Constructor Summary | |
|---|---|
HttpHandler()
Create HttpHandler. |
|
HttpHandler(java.lang.String name)
Create HttpHandler with the specific name. |
|
| Method Summary | |
|---|---|
protected void |
customizedErrorPage(Request req,
Response res)
Customize the error page. |
void |
destroy()
Invoked when the HttpServer and may be overridden by custom
implementations to perform implementation specific resource reclaimation
tasks. |
void |
doHandle(Request request,
Response response)
Pre-processes HttpHandler Request and Response,
checks the HTTP acknowledgment and decodes URL if required. |
java.lang.String |
getName()
Get the HttpHandler name. |
java.nio.charset.Charset |
getRequestURIEncoding()
Get the request URI encoding used by this HttpHandler. |
boolean |
isAllowCustomStatusMessage()
Returns true if custom status messages (reason phrases)
are allowed for this response, or false otherwise. |
boolean |
isAllowEncodedSlash()
Is HTTP URL request allowed to contains encoded slash. |
protected boolean |
sendAcknowledgment(Request request,
Response response)
The default implementation will acknowledge an Expect: 100-Continue
with a response line with the status 100 followed by the final response
to this request. |
abstract void |
service(Request request,
Response response)
This method should contain the logic for any HTTP extension to the Grizzly HTTP web server. |
void |
setAllowCustomStatusMessage(boolean allowCustomStatusMessage)
Sets if the custom status messages (reason phrases) are allowed for this response. |
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 |
protected void |
setDispatcherHelper(DispatcherHelper dispatcherHelper)
|
void |
setRequestURIEncoding(java.nio.charset.Charset requestURIEncoding)
Set the request URI encoding used by this HttpHandler. |
void |
setRequestURIEncoding(java.lang.String requestURIEncoding)
Set the request URI encoding used by this HttpHandler. |
void |
start()
Called when the HttpHandler's
container is started by invoking HttpServer.start(). |
protected static void |
updateContextPath(Request request,
java.lang.String contextPath)
Utility method to update Request context-path value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HttpHandler()
public HttpHandler(java.lang.String name)
| Method Detail |
|---|
public java.lang.String getName()
public final void doHandle(Request request,
Response response)
throws java.lang.Exception
Request and Response,
checks the HTTP acknowledgment and decodes URL if required. Then passes
control to service(Request, Response).
request - the Requestresponse - the Response
java.lang.Exception - if an error occurs serving a static resource or
from the invocation of service(Request, Response)
public abstract void service(Request request,
Response response)
throws java.lang.Exception
request - The Requestresponse - The Response
java.lang.Exceptionpublic void start()
HttpHandler's
container is started by invoking HttpServer.start().
By default, it does nothing.
public void destroy()
HttpServer and may be overridden by custom
implementations to perform implementation specific resource reclaimation
tasks.
By default, this method does nothing.
public boolean isAllowCustomStatusMessage()
true if custom status messages (reason phrases)
are allowed for this response, or false otherwise.
- Returns:
true if custom status messages (reason phrases)
are allowed for this response, or false otherwise.
public void setAllowCustomStatusMessage(boolean allowCustomStatusMessage)
allowCustomStatusMessage - true if custom status
messages (reason phrases) are allowed for this response,
or false otherwise.public boolean isAllowEncodedSlash()
public void setAllowEncodedSlash(boolean allowEncodedSlash)
allowEncodedSlash - truepublic java.nio.charset.Charset getRequestURIEncoding()
public void setRequestURIEncoding(java.nio.charset.Charset requestURIEncoding)
requestURIEncoding - the request URI encoding used by this HttpHandler.public void setRequestURIEncoding(java.lang.String requestURIEncoding)
requestURIEncoding - the request URI encoding used by this HttpHandler.
protected void customizedErrorPage(Request req,
Response res)
throws java.lang.Exception
req - The Request objectres - The Response object
java.lang.Exception
protected boolean sendAcknowledgment(Request request,
Response response)
throws java.io.IOException
Expect: 100-Continue
with a response line with the status 100 followed by the final response
to this request.
request - the Request.response - the Response.
true if request processing should continue after
acknowledgment of the expectation, otherwise return false.
java.io.IOException - if an error occurs sending the acknowledgment.protected void setDecodeUrl(boolean decodeURL)
protected static void updateContextPath(Request request,
java.lang.String contextPath)
Request context-path value.
request - contextPath - protected void setDispatcherHelper(DispatcherHelper dispatcherHelper)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||