org.apache.xmlrpc
public class WebServer extends Object implements Runnable
| Nested Class Summary | |
|---|---|
| class | WebServer.AddressMatcher |
| class | WebServer.Connection |
| class | WebServer.Runner
Responsible for handling client connections. |
| Field Summary | |
|---|---|
| protected Vector | accept |
| InetAddress | address |
| protected static byte[] | clength |
| protected static byte[] | conclose |
| protected static byte[] | conkeep |
| protected static byte[] | ctype |
| protected Vector | deny |
| protected static byte[] | doubleNewline |
| static String | HTTP_11 |
| protected Thread | listener |
| protected static byte[] | newline |
| protected static byte[] | ok |
| boolean | paranoid |
| int | port |
| protected ThreadGroup | runners |
| protected static byte[] | server |
| protected ServerSocket | serverSocket |
| static String | STAR |
| protected Stack | threadpool |
| protected static byte[] | wwwAuthenticate |
| protected XmlRpcServer | xmlrpc |
| Constructor Summary | |
|---|---|
| WebServer(int port)
Creates a web server at the specified port number. | |
| WebServer(int port, InetAddress addr)
Creates a web server at the specified port number and IP address. | |
| WebServer(int port, InetAddress addr, XmlRpcServer xmlrpc)
Creates a web server at the specified port number and IP
address. | |
| Method Summary | |
|---|---|
| void | acceptClient(String address)
Add an IP address to the list of accepted clients. |
| protected void | addDefaultHandlers()
Adds the bundled handlers to the server. |
| void | addHandler(String name, Object target)
Register a handler object with this name. |
| protected boolean | allowConnection(Socket s)
Checks incoming connections to see if they should be allowed.
|
| protected boolean | checkSocket(Socket s)
DEPRECATED: Do not use this method, it will be removed soon.
|
| protected ServerSocket | createServerSocket(int port, int backlog, InetAddress addr)
Factory method to manufacture the server socket. |
| void | denyClient(String address)
Add an IP address to the list of denied clients. |
| protected static int | determinePort(String[] argv, int defaultPort)
Examines command line arguments from argv. |
| protected WebServer.Runner | getRunner() |
| static void | main(String[] argv)
This can be called from command line, but you'll have to edit
and recompile to change the server port or handler objects. |
| void | removeHandler(String name)
Remove a handler object that was previously registered with this server. |
| void | repoolRunner(WebServer.Runner runner)
Put runner back into threadpool.
|
| void | run()
Listens for client requests until stopped. |
| void | setParanoid(boolean p)
Switch client filtering on/off. |
| void | setupServerSocket(int backlog)
Initializes this server's listener socket with the specified
attributes, assuring that a socket timeout has been set. |
| void | shutdown()
Stop listening on the server port. |
| void | start()
Spawns a new thread which binds this server to the port it's
configured to accept connections on.
|
| protected static byte[] | toHTTPBytes(String text)
Returns the US-ASCII encoded byte representation of text for
HTTP use (as per section 2.2 of RFC 2068). |
(String[]).Parameters: s The socket to inspect.
Returns: Whether the connection should be allowed.
Deprecated: Use allowConnection(Socket) instead.
DEPRECATED: Do not use this method, it will be removed soon. Use allowConnection instead.See Also: allowConnection
SSLServerSocket).
Parameters: port backlog addr If null, binds to
INADDR_ANY, meaning that all network interfaces on
a multi-homed host will be listening.
Throws: Exception Error creating listener socket.
argv. If a
port may have been provided, parses that port (exiting with
error status if the port cannot be parsed). If no port is
specified, defaults to defaultPort.
Parameters: defaultPort The port to use if none was specified.
Returns:
See Also: addDefaultHandlers
Throws: RuntimeException Generally caused by either an
UnknownHostException or BindException
with the vanilla web server.
See Also: WebServer
See Also: run
See Also: run