public class WebHubXmlRpcHandler extends ActorHandler
Constructor and Description |
---|
WebHubXmlRpcHandler(ClientProfile profile,
ClientAuthorizer auth,
KeyGenerator keyGen,
URL baseUrl,
UrlTracker urlTracker)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
HttpServer.Handler |
getUrlTranslationHandler()
Returns a handler suitable for performing URL translations on behalf
of sandboxed clients as required by the Web Profile.
|
Object |
handleCall(String fqName,
List params,
Object reqObj)
Processes an XML-RPC call.
|
protected Object |
invokeMethod(Method method,
Object obj,
Object[] args)
Invokes a method reflectively on an object.
|
canHandleCall, getActor
public WebHubXmlRpcHandler(ClientProfile profile, ClientAuthorizer auth, KeyGenerator keyGen, URL baseUrl, UrlTracker urlTracker)
profile
- hub connection factoryauth
- client authorizerkeyGen
- key generator for private keysbaseUrl
- base URL of HTTP server, used for URL translationurlTracker
- tracks URLs in messages to restrict use in URL
translation service for security reasons; may be null for
no restrictionspublic Object handleCall(String fqName, List params, Object reqObj) throws Exception
SampXmlRpcHandler
canHandleCall(method)
returns true.
The params
list and the return value must be
SAMP-compatible, that is only Strings, Lists and String-keyed Maps
are allowed in the data structures.
The reqInfo
parameter may be used to provide additional
information about the XML-RPC request, for instance the originating
host; this is implementation specific, and may be null.handleCall
in interface SampXmlRpcHandler
handleCall
in class ActorHandler
fqName
- XML-RPC method nameparams
- XML-RPC parameter list (SAMP-compatible)reqObj
- optional additional request information; may be nullException
public HttpServer.Handler getUrlTranslationHandler()
protected Object invokeMethod(Method method, Object obj, Object[] args) throws IllegalAccessException, InvocationTargetException
ActorHandler
return method.invoke(obj,params)
.
If the implementation is effectively prescribed, why is this
abstract method here? It's tricky.
The reason is so that reflective method invocation from this class
is done by code within the actor implementation class itself
rather than by code in the superclass, ActorHandler
.
That in turn means that the actorType
class specified
in the constructor does not need to be visible from
ActorHandler
's package, only from the package where
the implementation class lives.
invokeMethod
in class ActorHandler
method
- method to invokeobj
- object to invoke the method onargs
- arguments for the method callIllegalAccessException
InvocationTargetException
Method.invoke(java.lang.Object, java.lang.Object...)
Copyright © 2008–2024. All rights reserved.