org.mortbay.http
public class HttpConnection extends Object implements OutputObserver
Version: $Id: HttpConnection.java,v 1.94 2006/02/28 12:45:01 gregwilkins Exp $
See Also: HttpListener HttpServer
Field Summary | |
---|---|
protected int | _dotVersion |
protected boolean | _keepAlive |
protected boolean | _persistent |
protected HttpRequest | _request |
protected HttpResponse | _response |
Constructor Summary | |
---|---|
HttpConnection(HttpListener listener, InetAddress remoteAddr, InputStream in, OutputStream out, Object connection) Constructor. |
Method Summary | |
---|---|
protected void | associateThread() |
void | close() Close the connection.
|
protected void | commit() |
protected void | destroy() Destroy the connection.
called by handle when handleNext returns false. |
protected void | disassociateThread() |
protected void | firstWrite() Setup the reponse output stream.
|
void | forceClose() Force the connection to not be persistent. |
Object | getConnection() Get the underlying connection object.
|
String | getDefaultScheme() Get the listeners Default scheme.
|
HttpServer | getHttpServer() Get the listeners HttpServer .
|
HttpTunnel | getHttpTunnel() |
HttpInputStream | getInputStream() Get the connections InputStream. |
HttpListener | getListener() Get the connections listener. |
Object | getObject() Get associated object.
|
HttpOutputStream | getOutputStream() Get the connections OutputStream. |
String | getRemoteAddr() Get the Remote address. |
String | getRemoteHost() Get the Remote address. |
InetAddress | getRemoteInetAddress() Get the Remote address. |
int | getRemotePort() Get the remote Port . |
HttpRequest | getRequest() Get the request. |
HttpResponse | getResponse() Get the response. |
String | getServerAddr() Get the listeners HttpServer. |
String | getServerName() Get the listeners HttpServer.
|
int | getServerPort() Get the listeners Port .
|
void | handle() Handle the connection.
|
boolean | handleNext() Handle next request off the connection.
|
boolean | isThrottled() |
void | outputNotify(OutputStream out, int action, Object ignoredData) Output Notifications.
|
protected void | readRequest() |
protected void | recycle() Recycle the connection.
called by handle when handleNext returns true. |
protected HttpContext | service(HttpRequest request, HttpResponse response) Service a Request.
|
void | setHttpTunnel(HttpTunnel tunnel) Set a HttpTunnel for the connection.
|
void | setObject(Object o) Set associated object.
|
void | setThrottled(boolean throttled) |
protected void | statsRequestEnd() |
protected void | statsRequestStart() |
Parameters: listener The listener that created this connection. remoteAddr The address of the remote end or null. in InputStream to read request(s) from. out OutputputStream to write response(s) to. connection The underlying connection object, most likely a socket. This is not used by HttpConnection other than to make it available via getConnection().
Throws: IOException
Returns: Connection abject
Returns: HttpServer.
Returns: HttpServer.
Returns: The HttpTunnel set for the connection or null.
Returns: the connections InputStream
Returns: HttpListener that created this Connection.
Returns: An object associated with the connecton by setObject.
Returns: the connections OutputStream
Returns: the remote host name
Returns: the remote host name
Returns: the remote address
Returns: remote port.
Returns: the request
Returns: the response
Returns: HttpServer.
Returns: HttpServer.
Returns: local port.
If a HttpTunnel has been set on this connection, it's handle method is called and when that completes, false is return from this method.
The Connection is set as a ThreadLocal of the calling thread and is available via the getHttpConnection() method.
Returns: true if the connection is still open and may provide more requests.
Returns: True if this connections state has been altered due to low resources.
Parameters: out The output stream observed. action The action.
See Also: HttpOutputStream
Parameters: request The request response The response
Returns: The HttpContext that completed handling of the request or null.
Throws: HttpException IOException
Parameters: tunnel The HttpTunnel set for the connection or null.
Parameters: o An object associated with the connecton.
Parameters: throttled True if this connections state has been altered due to low resources.