public class DirectoryMapperHandler extends Object implements HttpServer.Handler
URLMapperHandler
class can sort of do the same thing,
but it's difficult to get the path right.
For if an instance is initialised as
new DirectoryMapperHandler("/files", "/data")
and installed on a server running at http://localhost:8000/
,
then a server request for http://localhost:8000/data/xxx
would be fulfilled by returning the content of the resource
/files/xxx
available to the JVM's classloader
(for instance within a jar file on the classpath).
Constructor and Description |
---|
DirectoryMapperHandler(String localDocBase,
String serverDocPath)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
HttpServer.Response |
serveRequest(HttpServer.Request request)
Provides a response to an HTTP request.
|
public HttpServer.Response serveRequest(HttpServer.Request request)
HttpServer.Handler
serveRequest
in interface HttpServer.Handler
request
- HTTP requestCopyright © 2008–2024. All rights reserved.