public class MultiURLMapperHandler extends Object implements HttpServer.Handler
The functionality of this class overlaps with that of
URLMapperHandler
. They may be merged at some point.
Constructor and Description |
---|
MultiURLMapperHandler(HttpServer server,
String basePath)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
URL |
addLocalUrl(URL localUrl)
Adds a local URL to the list of those which can be served by this
handler, and returns the public URL at which it will be available.
|
URL |
getBaseUrl()
Returns the base URL for resources served by this handler.
|
void |
removeServerUrl(URL url)
Removes access to a resource which was publicised by a previous call
to
addLocalUrl(java.net.URL) . |
HttpServer.Response |
serveRequest(HttpServer.Request request)
Provides a response to an HTTP request.
|
public MultiURLMapperHandler(HttpServer server, String basePath) throws MalformedURLException
server
- server within which this handler will be usedbasePath
- path of served resources relative to the base
URL of the server itselfMalformedURLException
public URL getBaseUrl()
public URL addLocalUrl(URL localUrl)
localUrl
- URL readable within this JVMlocalUrl
public void removeServerUrl(URL url)
addLocalUrl(java.net.URL)
.url
- result of previous call to addLocalUrl
public HttpServer.Response serveRequest(HttpServer.Request request)
HttpServer.Handler
serveRequest
in interface HttpServer.Handler
request
- HTTP requestCopyright © 2008–2024. All rights reserved.