public class ApacheServer extends java.lang.Object implements SampXmlRpcServer
Modifier and Type | Class and Description |
---|---|
private static class |
ApacheServer.LabelledServer
Convenience class which aggregates a WebServer and an endpoint.
|
Modifier and Type | Field and Description |
---|---|
private java.net.URL |
endpoint_ |
private java.util.List |
handlerList_ |
private WebServer |
webServer_ |
Modifier | Constructor and Description |
---|---|
|
ApacheServer()
Constructs a new server starting up a new WebServer object.
|
private |
ApacheServer(ApacheServer.LabelledServer server)
Private constructor used by all other constructors.
|
|
ApacheServer(WebServer webServer,
int port)
Constructs a new server based on a given WebServer object.
|
Modifier and Type | Method and Description |
---|---|
void |
addHandler(SampXmlRpcHandler handler)
Adds a handler which can service certain XML-RPC methods.
|
private static ApacheServer.LabelledServer |
createLabelledServer(boolean isDaemon)
Constructs a new LabelledServer object suitable for use with this
server.
|
private java.lang.Object |
doExecute(java.lang.String fqMethod,
java.util.Vector paramVec)
Does the work for executing an XML-RPC request.
|
java.net.URL |
getEndpoint()
Returns the server's endpoint.
|
private static java.net.URL |
getServerEndpoint(int port)
Returns the endpoint URL to use for an Apache server running on a
given port.
|
void |
removeHandler(SampXmlRpcHandler handler)
Removes a previously-added handler.
|
private final WebServer webServer_
private final java.net.URL endpoint_
private final java.util.List handlerList_
private ApacheServer(ApacheServer.LabelledServer server)
server
- server with metadatapublic ApacheServer(WebServer webServer, int port)
start
ing the WebServer and performing
any other required configuration lies with the caller.webServer
- apache xmlrpc webserver objectport
- port number on which the server is runningpublic ApacheServer() throws java.io.IOException
java.io.IOException
public java.net.URL getEndpoint()
SampXmlRpcServer
getEndpoint
in interface SampXmlRpcServer
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 removeprivate java.lang.Object doExecute(java.lang.String fqMethod, java.util.Vector paramVec) throws java.lang.Exception
fqMethod
- fully qualified XML-RPC method nameparamVec
- Apache-style list of method parametersjava.lang.Exception
private static ApacheServer.LabelledServer createLabelledServer(boolean isDaemon) throws java.io.IOException
isDaemon
- whether the WebServer's main thread should run
in daemon modejava.io.IOException
private static java.net.URL getServerEndpoint(int port)
port
- port number