public class ContentHttpHandler extends Object implements org.apache.http.protocol.HttpRequestHandler
/content/
path.
This handler is designed to server public files. It only accepts GET requests, and do not take into account query parameters.
Accessible files are stored in the <public/>
directory, and can be accessed using the following URL
template: <baseURL/content/path>
.
Constructor and Description |
---|
ContentHttpHandler(XatkitServer xatkitServer)
Constructs a new
ContentHttpHandler managed by the provided xatkitServer . |
Modifier and Type | Method and Description |
---|---|
void |
handle(org.apache.http.HttpRequest request,
org.apache.http.HttpResponse response,
org.apache.http.protocol.HttpContext context)
|
public ContentHttpHandler(XatkitServer xatkitServer)
ContentHttpHandler
managed by the provided xatkitServer
.xatkitServer
- the XatkitServer
managing this handler.public void handle(org.apache.http.HttpRequest request, org.apache.http.HttpResponse response, org.apache.http.protocol.HttpContext context)
request
and fill the provided response
with the retrieved File
to
serve.
This method relies on XatkitServer.getPublicFile(String)
to retrieve the public file associated to the
request target. If this File
doesn't exist or the accessed location is illegal the response is set to
HttpStatus.SC_NOT_FOUND
.
handle
in interface org.apache.http.protocol.HttpRequestHandler
request
- the received HttpRequest
response
- the HttpResponse
to send to the callercontext
- the HttpContext
associated to the received HttpRequest
Copyright © 2020 SOM Research Lab. All rights reserved.