|
||||||||||
| 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(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. |
String |
getName()
Get the HttpHandler name. |
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(Charset requestURIEncoding)
Set the request URI encoding used by this HttpHandler. |
void |
setRequestURIEncoding(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 |
updatePaths(Request request,
MappingData mappingData)
Utility method to update Request path values. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HttpHandler()
public HttpHandler(String name)
| Method Detail |
|---|
public String getName()
public final void doHandle(Request request,
Response response)
throws 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
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 Exception
request - The Requestresponse - The Response
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 Charset getRequestURIEncoding()
public void setRequestURIEncoding(Charset requestURIEncoding)
requestURIEncoding - the request URI encoding used by this HttpHandler.public void setRequestURIEncoding(String requestURIEncoding)
requestURIEncoding - the request URI encoding used by this HttpHandler.
protected void customizedErrorPage(Request req,
Response res)
throws Exception
req - The Request objectres - The Response object
Exception
protected boolean sendAcknowledgment(Request request,
Response response)
throws 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.
IOException - if an error occurs sending the acknowledgment.protected void setDecodeUrl(boolean decodeURL)
protected static void updatePaths(Request request,
MappingData mappingData)
Request path values.
request - mappingData - protected void setDispatcherHelper(DispatcherHelper dispatcherHelper)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||