Package org.astrogrid.samp.web
Class WebHubXmlRpcHandler.URLTranslationHandler
- java.lang.Object
-
- org.astrogrid.samp.web.WebHubXmlRpcHandler.URLTranslationHandler
-
- All Implemented Interfaces:
HttpServer.Handler
- Enclosing class:
- WebHubXmlRpcHandler
private static class WebHubXmlRpcHandler.URLTranslationHandler extends java.lang.Object implements HttpServer.Handler
HTTP handler which provides URL translation services for sandboxed clients.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
basePath_
private java.util.Set
keySet_
private UrlTracker
urlTracker_
-
Constructor Summary
Constructors Constructor Description URLTranslationHandler(java.lang.String basePath, java.util.Set keySet, UrlTracker urlTracker)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getTranslationBasePath(java.lang.String privateKey)
Returns the translation base path that can be used by a client with a given private key.HttpServer.Response
serveRequest(HttpServer.Request request)
Provides a response to an HTTP request.
-
-
-
Field Detail
-
basePath_
private final java.lang.String basePath_
-
keySet_
private final java.util.Set keySet_
-
urlTracker_
private final UrlTracker urlTracker_
-
-
Constructor Detail
-
URLTranslationHandler
public URLTranslationHandler(java.lang.String basePath, java.util.Set keySet, UrlTracker urlTracker)
Constructor.- Parameters:
basePath
- base path for HTTP serverkeySet
- set of strings which contains keys for all currently registered clientsurlTracker
- controls access to translated URLs, may be null for no control
-
-
Method Detail
-
getTranslationBasePath
public java.lang.String getTranslationBasePath(java.lang.String privateKey)
Returns the translation base path that can be used by a client with a given private key.- Parameters:
privateKey
- client private key- Returns:
- URL translation base path that can be used by a registered client with the given private key
-
serveRequest
public HttpServer.Response serveRequest(HttpServer.Request request)
Description copied from interface:HttpServer.Handler
Provides a response to an HTTP request. A handler which does not recognise the URL should simply return null; in this case there may be another handler which is able to serve the request. If the URL appears to be in this handler's domain but the request cannot be served for some reason, an error response should be returned.- Specified by:
serveRequest
in interfaceHttpServer.Handler
- Parameters:
request
- HTTP request- Returns:
- response response to request, or null
-
-