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 itselfMalformedURLExceptionpublic URL getBaseUrl()
public URL addLocalUrl(URL localUrl)
localUrl - URL readable within this JVMlocalUrlpublic void removeServerUrl(URL url)
addLocalUrl(java.net.URL).url - result of previous call to addLocalUrlpublic HttpServer.Response serveRequest(HttpServer.Request request)
HttpServer.HandlerserveRequest in interface HttpServer.Handlerrequest - HTTP requestCopyright © 2008–2024. All rights reserved.