Classes | |
class | BadEncodingException |
class | BadRequestException |
class | RequestException |
Public Member Functions | |
void | close () throws IOException |
Connection (WebServer pWebServer, XmlRpcStreamServer pServer, Socket pSocket) throws IOException | |
InputStream | newInputStream () throws IOException |
OutputStream | newOutputStream () throws IOException |
void | run () |
void | setResponseHeader (String pHeader, String pValue) |
void | shutdown () throws Throwable |
void | writeError (RequestData pData, Throwable pError, ByteArrayOutputStream pStream) throws IOException |
void | writeErrorHeader (RequestData pData, Throwable pError, int pContentLength) throws IOException |
void | writeResponse (RequestData pData, OutputStream pBuffer) throws IOException |
void | writeResponseHeader (RequestData pData, int pContentLength) throws IOException |
Private Member Functions | |
RequestData | getRequestConfig () throws IOException |
String | readLine () throws IOException |
void | writeContentLengthHeader (int pContentLength) throws IOException |
Static Private Member Functions | |
static final byte[] | toHTTPBytes (String text) |
Private Attributes | |
byte[] | buffer |
boolean | firstByte |
Map | headers |
final InputStream | input |
final OutputStream | output |
RequestData | requestData |
final XmlRpcStreamServer | server |
boolean | shuttingDown |
final Socket | socket |
final WebServer | webServer |
Static Private Attributes | |
static final byte[] | clength = toHTTPBytes("Content-Length: ") |
static final byte[] | conclose = toHTTPBytes("Connection: close\r\n") |
static final byte[] | conkeep = toHTTPBytes("Connection: Keep-Alive\r\n") |
static final byte[] | ctype = toHTTPBytes("Content-Type: text/xml\r\n") |
static final byte[] | doubleNewline = toHTTPBytes("\r\n\r\n") |
static final byte[] | newline = toHTTPBytes("\r\n") |
static final byte[] | ok = toHTTPBytes(" 200 OK\r\n") |
static final byte[] | serverName = toHTTPBytes("Server: Apache XML-RPC 1.0\r\n") |
static final String | US_ASCII = "US-ASCII" |
static final byte[] | wwwAuthenticate = toHTTPBytes("WWW-Authenticate: Basic realm=XML-RPC\r\n") |
Handler for a single clients connection. This implementation is able to do HTTP keepalive. In other words, it can serve multiple requests via a single, physical connection.
Definition at line 49 of file Connection.java.
org.apache.xmlrpc.webserver.Connection.Connection | ( | WebServer | pWebServer, |
XmlRpcStreamServer | pServer, | ||
Socket | pSocket | ||
) | throws IOException [inline] |
Creates a new webserver connection on the given socket.
pWebServer | The webserver maintaining this connection. |
pServer | The server being used to execute requests. |
pSocket | The server socket to handle; the Connection is responsible for closing this socket. |
IOException |
It may happen, that the XML parser invokes close(). Closing the input stream must not occur, because that would close the whole socket. So we suppress it.
Definition at line 116 of file Connection.java.
void org.apache.xmlrpc.webserver.Connection.close | ( | ) | throws IOException [inline] |
Closes the connection, and frees resources.
Implements org.apache.xmlrpc.common.ServerStreamConnection.
Definition at line 405 of file Connection.java.
RequestData org.apache.xmlrpc.webserver.Connection.getRequestConfig | ( | ) | throws IOException [inline, private] |
Returns the connections request configuration by merging the HTTP request headers and the servers configuration.
IOException | Reading the request headers failed. |
Definition at line 137 of file Connection.java.
InputStream org.apache.xmlrpc.webserver.Connection.newInputStream | ( | ) | throws IOException [inline] |
Returns the connections input stream.
Implements org.apache.xmlrpc.common.ServerStreamConnection.
Definition at line 396 of file Connection.java.
OutputStream org.apache.xmlrpc.webserver.Connection.newOutputStream | ( | ) | throws IOException [inline] |
Returns the connections output stream.
Implements org.apache.xmlrpc.common.ServerStreamConnection.
Definition at line 385 of file Connection.java.
String org.apache.xmlrpc.webserver.Connection.readLine | ( | ) | throws IOException [inline, private] |
Definition at line 233 of file Connection.java.
void org.apache.xmlrpc.webserver.Connection.run | ( | ) | [inline] |
Performs the task.
Throwable | The task failed, and the worker thread won't be used again. |
Implements org.apache.xmlrpc.util.ThreadPool.Task.
Definition at line 201 of file Connection.java.
void org.apache.xmlrpc.webserver.Connection.setResponseHeader | ( | String | pHeader, |
String | pValue | ||
) | [inline] |
Sets a response header value.
Definition at line 380 of file Connection.java.
void org.apache.xmlrpc.webserver.Connection.shutdown | ( | ) | throws Throwable [inline] |
Interrupts the task.
Throwable | Shutting down the task failed. |
Implements org.apache.xmlrpc.util.ThreadPool.InterruptableTask.
Definition at line 408 of file Connection.java.
static final byte [] org.apache.xmlrpc.webserver.Connection.toHTTPBytes | ( | String | text | ) | [inline, static, private] |
Returns the US-ASCII encoded byte representation of text for HTTP use (as per section 2.2 of RFC 2068).
Definition at line 89 of file Connection.java.
void org.apache.xmlrpc.webserver.Connection.writeContentLengthHeader | ( | int | pContentLength | ) | throws IOException [inline, private] |
Definition at line 369 of file Connection.java.
void org.apache.xmlrpc.webserver.Connection.writeError | ( | RequestData | pData, |
Throwable | pError, | ||
ByteArrayOutputStream | pStream | ||
) | throws IOException [inline] |
Writes an error response to the output stream.
pData | The request data. |
pError | The error being reported. |
pStream | The ByteArrayOutputStream with the error response. |
IOException | Writing the response failed. |
Definition at line 312 of file Connection.java.
void org.apache.xmlrpc.webserver.Connection.writeErrorHeader | ( | RequestData | pData, |
Throwable | pError, | ||
int | pContentLength | ||
) | throws IOException [inline] |
Writes an error responses headers to the output stream.
pData | The request data. |
pError | The error being reported. |
pContentLength | The response length, if known, or -1. |
IOException | Writing the response failed. |
Definition at line 325 of file Connection.java.
void org.apache.xmlrpc.webserver.Connection.writeResponse | ( | RequestData | pData, |
OutputStream | pBuffer | ||
) | throws IOException [inline] |
Writes the response header and the response to the output stream.
pData | The request data. |
pBuffer | The ByteArrayOutputStream holding the response. |
IOException | Writing the response failed. |
Definition at line 269 of file Connection.java.
void org.apache.xmlrpc.webserver.Connection.writeResponseHeader | ( | RequestData | pData, |
int | pContentLength | ||
) | throws IOException [inline] |
Writes the response header to the output stream. *
pData | The request data |
pContentLength | The content length, if known, or -1. |
IOException | Writing the response failed. |
Definition at line 281 of file Connection.java.
byte [] org.apache.xmlrpc.webserver.Connection.buffer [private] |
Definition at line 103 of file Connection.java.
final byte [] org.apache.xmlrpc.webserver.Connection.clength = toHTTPBytes("Content-Length: ") [static, private] |
Definition at line 52 of file Connection.java.
final byte [] org.apache.xmlrpc.webserver.Connection.conclose = toHTTPBytes("Connection: close\r\n") [static, private] |
Definition at line 56 of file Connection.java.
final byte [] org.apache.xmlrpc.webserver.Connection.conkeep = toHTTPBytes("Connection: Keep-Alive\r\n") [static, private] |
Definition at line 55 of file Connection.java.
final byte [] org.apache.xmlrpc.webserver.Connection.ctype = toHTTPBytes("Content-Type: text/xml\r\n") [static, private] |
Definition at line 51 of file Connection.java.
final byte [] org.apache.xmlrpc.webserver.Connection.doubleNewline = toHTTPBytes("\r\n\r\n") [static, private] |
Definition at line 54 of file Connection.java.
boolean org.apache.xmlrpc.webserver.Connection.firstByte [private] |
Definition at line 107 of file Connection.java.
Map org.apache.xmlrpc.webserver.Connection.headers [private] |
Definition at line 104 of file Connection.java.
final InputStream org.apache.xmlrpc.webserver.Connection.input [private] |
Definition at line 100 of file Connection.java.
final byte [] org.apache.xmlrpc.webserver.Connection.newline = toHTTPBytes("\r\n") [static, private] |
Definition at line 53 of file Connection.java.
final byte [] org.apache.xmlrpc.webserver.Connection.ok = toHTTPBytes(" 200 OK\r\n") [static, private] |
Definition at line 57 of file Connection.java.
final OutputStream org.apache.xmlrpc.webserver.Connection.output [private] |
Definition at line 101 of file Connection.java.
Definition at line 105 of file Connection.java.
final XmlRpcStreamServer org.apache.xmlrpc.webserver.Connection.server [private] |
Definition at line 102 of file Connection.java.
final byte [] org.apache.xmlrpc.webserver.Connection.serverName = toHTTPBytes("Server: Apache XML-RPC 1.0\r\n") [static, private] |
Definition at line 58 of file Connection.java.
boolean org.apache.xmlrpc.webserver.Connection.shuttingDown [private] |
Definition at line 106 of file Connection.java.
final Socket org.apache.xmlrpc.webserver.Connection.socket [private] |
Definition at line 99 of file Connection.java.
final String org.apache.xmlrpc.webserver.Connection.US_ASCII = "US-ASCII" [static, private] |
Definition at line 50 of file Connection.java.
final WebServer org.apache.xmlrpc.webserver.Connection.webServer [private] |
Definition at line 98 of file Connection.java.
final byte [] org.apache.xmlrpc.webserver.Connection.wwwAuthenticate = toHTTPBytes("WWW-Authenticate: Basic realm=XML-RPC\r\n") [static, private] |
Definition at line 59 of file Connection.java.