public class DefaultHTTPSession extends HTTPSession
Default HTTP Session implementation.
Retrieves the URI of the request and tries to find a matching resource.
Example:
Given the URI http://192.168.1.1/my/wonderful/resource.html, the Default HTTP Session will try to find
the resource /my/wonderful/resource.html in the application's classpath (using
Class.getResourceAsStream(String)).
| Constructor and Description |
|---|
DefaultHTTPSession(HTTPServer server)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
HTTPResponse |
answer(HTTPRequest request)
The generic behaviour of this session implementation is to find a resource matching the given URI in the
classpath.
|
checkHTTPError, closeConnection, createErrorResponse, getAcceptEncodingHandler, getBodyParserFactory, getRunnable, sendError, sendError, sendResponse, setBodyParserFactory, setCurrentConnection, writeResponsepublic DefaultHTTPSession(HTTPServer server)
Default constructor.
server - the HTTPServer to associate with this session.public HTTPResponse answer(HTTPRequest request)
The generic behaviour of this session implementation is to find a resource matching the given URI in the classpath. The resource is included in the HTTP Response with the proper MIME-Type and HTTP Status (200 OK).
If no resource found, a HTTP 404 error response is returned.
answer in class HTTPSessionrequest - the HTTPRequestHTTPResponse containing the resource