public class Connection extends Object implements ThreadPool.InterruptableTask, ServerStreamConnection
| Constructor and Description |
|---|
Connection(WebServer pWebServer,
XmlRpcStreamServer pServer,
Socket pSocket)
Creates a new webserver connection on the given socket.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
public Connection(WebServer pWebServer, XmlRpcStreamServer pServer, Socket pSocket) throws 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.IOExceptionpublic void run()
ThreadPool.Taskrun in interface ThreadPool.Taskpublic void writeResponse(RequestData pData, OutputStream pBuffer) throws IOException
pData - The request data.pBuffer - The ByteArrayOutputStream holding the response.IOException - Writing the response failed.public void writeResponseHeader(RequestData pData, int pContentLength) throws IOException
pData - The request datapContentLength - The content length, if known, or -1.IOException - Writing the response failed.public void writeError(RequestData pData, Throwable pError, ByteArrayOutputStream pStream) throws IOException
pData - The request data.pError - The error being reported.pStream - The ByteArrayOutputStream with the error response.IOException - Writing the response failed.public void writeErrorHeader(RequestData pData, Throwable pError, int pContentLength) throws IOException
pData - The request data.pError - The error being reported.pContentLength - The response length, if known, or -1.IOException - Writing the response failed.public void setResponseHeader(String pHeader, String pValue)
public OutputStream newOutputStream() throws IOException
ServerStreamConnectionnewOutputStream in interface ServerStreamConnectionIOExceptionpublic InputStream newInputStream() throws IOException
ServerStreamConnectionnewInputStream in interface ServerStreamConnectionIOExceptionpublic void close()
throws IOException
ServerStreamConnectionclose in interface ServerStreamConnectionIOExceptionpublic void shutdown()
throws Throwable
ThreadPool.InterruptableTaskshutdown in interface ThreadPool.InterruptableTaskThrowable - Shutting down the task failed.Copyright © 2001–2025 The Apache Software Foundation. All rights reserved.