Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
org.apache.xmlrpc.webserver.Connection Class Reference
Inheritance diagram for org.apache.xmlrpc.webserver.Connection:
Inheritance graph
[legend]

List of all members.

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")

Detailed Description

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.


Constructor & Destructor Documentation

org.apache.xmlrpc.webserver.Connection.Connection ( WebServer  pWebServer,
XmlRpcStreamServer  pServer,
Socket  pSocket 
) throws IOException [inline]

Creates a new webserver connection on the given socket.

Parameters:
pWebServerThe webserver maintaining this connection.
pServerThe server being used to execute requests.
pSocketThe server socket to handle; the Connection is responsible for closing this socket.
Exceptions:
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.


Member Function Documentation

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.

Returns:
The connections request configuration.
Exceptions:
IOExceptionReading 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.

Performs the task.

Exceptions:
ThrowableThe 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.

Exceptions:
ThrowableShutting 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.

Parameters:
pDataThe request data.
pErrorThe error being reported.
pStreamThe ByteArrayOutputStream with the error response.
Exceptions:
IOExceptionWriting 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.

Parameters:
pDataThe request data.
pErrorThe error being reported.
pContentLengthThe response length, if known, or -1.
Exceptions:
IOExceptionWriting 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.

Parameters:
pDataThe request data.
pBufferThe ByteArrayOutputStream holding the response.
Exceptions:
IOExceptionWriting 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. *

Parameters:
pDataThe request data
pContentLengthThe content length, if known, or -1.
Exceptions:
IOExceptionWriting the response failed.

Definition at line 281 of file Connection.java.


Member Data Documentation

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.

Definition at line 107 of file Connection.java.

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.

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.

Definition at line 106 of file Connection.java.

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.

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.


The documentation for this class was generated from the following file:


rosjava_core
Author(s):
autogenerated on Wed Aug 26 2015 16:06:50