org.apache.xmlrpc.webserver
Class Connection
java.lang.Object
org.apache.xmlrpc.webserver.Connection
- ServerStreamConnection, ThreadPool.InterruptableTask, ThreadPool.Task
public class Connection
extends java.lang.Object
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.
void | close() - Closes the connection, and frees resources.
|
InputStream | newInputStream() - Returns the connections input stream.
|
OutputStream | newOutputStream() - Returns the connections output stream.
|
void | run() - Performs the task.
|
void | setResponseHeader(String pHeader, String pValue) - Sets a response header value.
|
void | shutdown() - Interrupts the task.
|
void | writeError(RequestData pData, Throwable pError, ByteArrayOutputStream pStream) - Writes an error response to the output stream.
|
void | writeErrorHeader(RequestData pData, Throwable pError, int pContentLength) - Writes an error responses headers to the output stream.
|
void | writeResponse(RequestData pData, OutputStream pBuffer) - Writes the response header and the response to the
output stream.
|
void | writeResponseHeader(RequestData pData, int pContentLength) - Writes the response header to the output stream.
|
Connection
public Connection(WebServer pWebServer,
XmlRpcStreamServer pServer,
Socket pSocket)
throws IOException
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.
setResponseHeader
public void setResponseHeader(String pHeader,
String pValue)
Sets a response header value.
writeError
public void writeError(RequestData pData,
Throwable pError,
ByteArrayOutputStream pStream)
throws IOException
Writes an error response to the output stream.
pData
- The request data.pError
- The error being reported.pStream
- The ByteArrayOutputStream
with the error response.
writeErrorHeader
public void writeErrorHeader(RequestData pData,
Throwable pError,
int pContentLength)
throws IOException
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.
writeResponse
public void writeResponse(RequestData pData,
OutputStream pBuffer)
throws IOException
Writes the response header and the response to the
output stream.
pData
- The request data.pBuffer
- The ByteArrayOutputStream
holding the response.
writeResponseHeader
public void writeResponseHeader(RequestData pData,
int pContentLength)
throws IOException
Writes the response header to the output stream. *
pData
- The request datapContentLength
- The content length, if known, or -1.
Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.