public class Connection
extends java.lang.Object
Constructor and Description |
---|
Connection(WebServer pWebServer,
XmlRpcStreamServer pServer,
java.net.Socket pSocket)
Creates a new webserver connection on the given socket.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
java.io.InputStream |
newInputStream() |
java.io.OutputStream |
newOutputStream() |
void |
run() |
void |
setResponseHeader(java.lang.String pHeader,
java.lang.String pValue)
Sets a response header value.
|
void |
writeError(RequestData pData,
java.lang.Throwable pError,
java.io.OutputStream pStream)
Writes an error response to the output stream.
|
void |
writeErrorHeader(RequestData pData,
java.lang.Throwable pError,
int pContentLength)
Writes an error responses headers to the output stream.
|
void |
writeResponse(RequestData pData,
java.io.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.
|
public Connection(WebServer pWebServer, XmlRpcStreamServer pServer, java.net.Socket pSocket) throws java.io.IOException
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.java.io.IOException
public void run()
public void writeResponse(RequestData pData, java.io.OutputStream pBuffer) throws java.io.IOException
pData
- The request data.pBuffer
- The ByteArrayOutputStream
holding the response.java.io.IOException
- Writing the response failed.public void writeResponseHeader(RequestData pData, int pContentLength) throws java.io.IOException
pData
- The request datapContentLength
- The content length, if known, or -1.java.io.IOException
- Writing the response failed.public void writeError(RequestData pData, java.lang.Throwable pError, java.io.OutputStream pStream) throws java.io.IOException
pData
- The request data.pError
- The error being reported.pStream
- The ByteArrayOutputStream
with the error response.java.io.IOException
- Writing the response failed.public void writeErrorHeader(RequestData pData, java.lang.Throwable pError, int pContentLength) throws java.io.IOException
pData
- The request data.pError
- The error being reported.pContentLength
- The response length, if known, or -1.java.io.IOException
- Writing the response failed.public void setResponseHeader(java.lang.String pHeader, java.lang.String pValue)
public java.io.OutputStream newOutputStream() throws java.io.IOException
java.io.IOException
public java.io.InputStream newInputStream() throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
java.io.IOException