|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.grizzly.http.server.HttpService
public abstract class HttpService
Base class to use when Request/Response/InputStream/OutputStream
are needed to implement a customized HTTP container/extension to the
HTTP module.
The HttpService 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.
| Field Summary | |
|---|---|
protected StaticResourcesHandler |
staticResourcesHandler
|
| Constructor Summary | |
|---|---|
HttpService()
Create HttpService, which, by default, won't handle requests to the static resources. |
|
HttpService(String docRoot)
Create a new instance which will look for static pages located under the docRoot. |
|
| Method Summary | |
|---|---|
protected void |
customizedErrorPage(HttpServer server,
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 |
doService(Request request,
Response response)
Handles static resources if this service is configured to do so, otherwise invokes service(Request, Response). |
File |
getDocRoot()
Return the directory from where files will be serviced, or null, if static resources won't be served by this HttpService. |
StaticResourcesHandler |
getStaticResourcesHandler()
Get StaticResourcesHandler, which handles requests to a static resources. |
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 |
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 |
setDocRoot(File docRoot)
Set the directory from where files will be serviced, if passed value is null - static resources won't be served by this HttpService. |
void |
setDocRoot(String docRoot)
Set the directory from where files will be serviced, if passed value is null - static resources won't be served by this HttpService. |
void |
start()
Called when the HttpService's
container is started by invoking HttpServer.start(). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final StaticResourcesHandler staticResourcesHandler
| Constructor Detail |
|---|
public HttpService()
public HttpService(String docRoot)
docRoot - the folder where the static resource are located.
If the docRoot is null - static pages won't be served
by this HttpService| Method Detail |
|---|
public final void doService(Request request,
Response response)
throws Exception
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()
HttpService'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 StaticResourcesHandler getStaticResourcesHandler()
StaticResourcesHandler, which handles requests to a static resources.
StaticResourcesHandler, which handles requests to a static resources.public boolean isAllowEncodedSlash()
public void setAllowEncodedSlash(boolean allowEncodedSlash)
allowEncodedSlash - truepublic File getDocRoot()
public void setDocRoot(String docRoot)
docRoot - the directory from where files will be serviced, if passed value is
null - static resources won't be served by this HttpService.public void setDocRoot(File docRoot)
docRoot - the directory from where files will be serviced, if passed value is
null - static resources won't be served by this HttpService.
protected void customizedErrorPage(HttpServer server,
Request req,
Response res)
throws Exception
server - the HttpServer associated with this service.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
acknowledgement of the expectation, otherwise return false.
IOException - if an error occurs sending the acknowledgement.protected void setDecodeUrl(boolean decodeURL)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||