public abstract class HttpHandler extends Object
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 and Description |
---|
HttpHandler()
Create HttpHandler.
|
HttpHandler(String name)
Create HttpHandler with the specific name.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Invoked when the
HttpServer and may be overridden by custom
implementations to perform implementation specific resource reclaimation
tasks. |
protected ErrorPageGenerator |
getErrorPageGenerator(Request request)
Returns the
ErrorPageGenerator , that might be used
(if an error occurs) during Request processing. |
String |
getName()
Get the HttpHandler name.
|
RequestExecutorProvider |
getRequestExecutorProvider() |
Charset |
getRequestURIEncoding()
Get the request URI encoding used by this HttpHandler.
|
protected String |
getSessionCookieName() |
protected SessionManager |
getSessionManager() |
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. |
public HttpHandler()
public HttpHandler(String name)
name
- public String getName()
public abstract void service(Request request, Response response) throws Exception
public 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.
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.public RequestExecutorProvider getRequestExecutorProvider()
RequestExecutorProvider
responsible for executing
user's code in service(org.glassfish.grizzly.http.server.Request, org.glassfish.grizzly.http.server.Response)
and notifying ReadHandler
, WriteHandler
registered by the user.protected ErrorPageGenerator getErrorPageGenerator(Request request)
ErrorPageGenerator
, that might be used
(if an error occurs) during Request
processing.request
- Request
ErrorPageGenerator
, that might be used
(if an error occurs) during Request
processingprotected String getSessionCookieName()
protected SessionManager getSessionManager()
SessionManager
to be used. null value implies DefaultSessionManager
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)
Copyright © 2015 Oracle Corporation. All rights reserved.