public abstract class ServerMethodHandler
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
adminKey
The server service key
|
protected boolean |
isBlocking
True if blocking call
|
protected boolean |
isXmlRpc
True if licas xml-rpc parsing
|
Constructor and Description |
---|
ServerMethodHandler(java.lang.String theAdminKey)
Create a new instance of ServerMethodHandler.
|
Modifier and Type | Method and Description |
---|---|
protected void |
badRequestResponse(HttpEntity response,
java.lang.String message)
Set values in the response to indicate a bad request.
|
MethodInfo |
convertRequest(HttpEntity request)
Convert a message request description into a
MethodInfo object. |
protected void |
convertResponse(HttpEntity response,
java.lang.Object reply)
Configure the response object based on the message reply.
|
protected void |
forbiddenResponse(HttpEntity response)
Set values in the response to indicate a forbidden request.
|
abstract HttpEntity |
handleMethodExecution(BusEntity bo)
Handle the HTTP request.
|
protected void |
noContentResponse(HttpEntity response)
Set values in the response to indicate a no content reply.
|
protected void |
notFoundResponse(HttpEntity response)
Set values in the response to indicate a not found response.
|
protected boolean |
processLocalCall(MethodInfo methodInfo,
HttpEntity response)
Process a direct server call with no service invocation, if it is one.
|
protected HttpEntity |
processServiceCall(BusEntity bo)
Process a direct server call with no service invocation, if it is one.
|
static boolean |
serverRequest(java.lang.String message,
MethodInfo methodInfo)
Return true if the message part is likely to be for a local server request,
such as retrieve a file, not a service invocation.
|
protected boolean isBlocking
protected boolean isXmlRpc
protected java.lang.String adminKey
public ServerMethodHandler(java.lang.String theAdminKey) throws java.lang.Exception
theAdminKey
- the server admin key.java.lang.Exception
- any error.public abstract HttpEntity handleMethodExecution(BusEntity bo)
bo
- the object retrieved from the message bus.public static boolean serverRequest(java.lang.String message, MethodInfo methodInfo) throws java.lang.Exception
methodInfo
object is also updated.message
- the message part to evaluate.methodInfo
- the method info to update with pre-defined values.java.lang.Exception
- any error.protected boolean processLocalCall(MethodInfo methodInfo, HttpEntity response) throws java.lang.Exception
methodInfo
- the full method description.response
- the response http object to return. Can be null.java.lang.Exception
- any error.protected HttpEntity processServiceCall(BusEntity bo)
bo
- the object retrieved from the message bus.public MethodInfo convertRequest(HttpEntity request) throws java.lang.Exception
MethodInfo
object.
This determines the request type (XML-RPC or REST
) and parses as required.request
- the whole http request.java.lang.Exception
- any error.protected void convertResponse(HttpEntity response, java.lang.Object reply)
response
- the response object.reply
- method call reply, or null.protected void noContentResponse(HttpEntity response)
response
- the response object.protected void forbiddenResponse(HttpEntity response)
response
- the response object.protected void notFoundResponse(HttpEntity response)
response
- the response object.protected void badRequestResponse(HttpEntity response, java.lang.String message)
response
- the response object.message
- an additional message.