public class InternalServer extends Object implements SampXmlRpcServer
reqInfo argument passed to the
handleCall method of registered
SampXmlRpcHandlers 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 "/");IOExceptionpublic InternalServer()
throws IOException
UtilServer.getInstance() is used.IOExceptionpublic URL getEndpoint()
SampXmlRpcServergetEndpoint in interface SampXmlRpcServerpublic HttpServer getHttpServer()
public void addHandler(SampXmlRpcHandler handler)
SampXmlRpcServeraddHandler in interface SampXmlRpcServerhandler - handler to addpublic void removeHandler(SampXmlRpcHandler handler)
SampXmlRpcServerremoveHandler in interface SampXmlRpcServerhandler - 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 originatedExceptionpublic static byte[] getResultBytes(Object result) throws IOException
result - SAMP-friendly objectIOExceptionpublic static byte[] getFaultBytes(Throwable error) throws IOException
error - throwableIOExceptionCopyright © 2008–2024. All rights reserved.