public class InternalServer extends Object implements SampXmlRpcServer
reqInfo
argument passed to the
handleCall
method of registered
SampXmlRpcHandler
s is the associated
HttpServer.Request
.Constructor and Description |
---|
InternalServer()
Constructs a server running with default characteristics.
|
InternalServer(HttpServer httpServer,
String path)
Constructor based on a given HTTP server.
|
Modifier and Type | Method and Description |
---|---|
void |
addHandler(SampXmlRpcHandler handler)
Adds a handler which can service certain XML-RPC methods.
|
URL |
getEndpoint()
Returns the server's endpoint.
|
static byte[] |
getFaultBytes(Throwable error)
Turns an exception into an array of bytes giving an XML-RPC
methodResponse (fault) document.
|
HttpServer |
getHttpServer()
Returns the HTTP server hosting this XML-RPC server.
|
static byte[] |
getResultBytes(Object result)
Turns a SAMP-friendly (string, list, map only) object into an array
of bytes giving an XML-RPC methodResponse document.
|
protected HttpServer.Response |
getXmlRpcResponse(HttpServer.Request request)
Returns the HTTP response object given an incoming XML-RPC POST request.
|
protected Object |
handleCall(SampXmlRpcHandler handler,
String methodName,
List paramList,
HttpServer.Request request)
Actually passes the XML-RPC method name and parameter list to one
of the registered servers for processing.
|
void |
removeHandler(SampXmlRpcHandler handler)
Removes a previously-added handler.
|
public InternalServer(HttpServer httpServer, String path) throws IOException
httpServer
- server for processing HTTP requestspath
- path part of server endpoint (starts with "/");IOException
public InternalServer() throws IOException
UtilServer.getInstance()
is used.IOException
public URL getEndpoint()
SampXmlRpcServer
getEndpoint
in interface SampXmlRpcServer
public HttpServer getHttpServer()
public void addHandler(SampXmlRpcHandler handler)
SampXmlRpcServer
addHandler
in interface SampXmlRpcServer
handler
- handler to addpublic void removeHandler(SampXmlRpcHandler handler)
SampXmlRpcServer
removeHandler
in interface SampXmlRpcServer
handler
- handler to removeprotected HttpServer.Response getXmlRpcResponse(HttpServer.Request request)
request
- POSTed HTTP requestprotected Object handleCall(SampXmlRpcHandler handler, String methodName, List paramList, HttpServer.Request request) throws Exception
handler
- handler which has declared it can handle the
named methodmethodName
- XML-RPC method nameparamList
- list of parameters to XML-RPC callrequest
- HTTP request from which this call originatedException
public static byte[] getResultBytes(Object result) throws IOException
result
- SAMP-friendly objectIOException
public static byte[] getFaultBytes(Throwable error) throws IOException
error
- throwableIOException
Copyright © 2008–2024. All rights reserved.