|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.mortbay.http.HttpConnection
A HTTP Connection. This class provides the generic HTTP handling for a connection to a HTTP server. An instance of HttpConnection is normally created by a HttpListener and then given control in order to run the protocol handling before and after passing a request to the HttpServer of the HttpListener. This class is not synchronized as it should only ever be known to a single thread.
HttpListener
,
HttpServer
Field Summary |
Fields inherited from interface org.mortbay.util.OutputObserver |
__CLOSED, __CLOSING, __COMMITING, __FIRST_WRITE, __RESET_BUFFER |
Constructor Summary | |
HttpConnection(HttpListener listener,
java.net.InetAddress remoteAddr,
java.io.InputStream in,
java.io.OutputStream out,
java.lang.Object connection)
Constructor. |
Method Summary | |
void |
close()
Close the connection. |
void |
forceClose()
Force the connection to not be persistent. |
java.lang.Object |
getConnection()
Get the underlying connection object. |
java.lang.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. |
java.lang.Object |
getObject()
Get associated object. |
HttpOutputStream |
getOutputStream()
Get the connections OutputStream. |
java.lang.String |
getRemoteAddr()
Get the Remote address. |
java.lang.String |
getRemoteHost()
Get the Remote address. |
java.net.InetAddress |
getRemoteInetAddress()
Get the Remote address. |
HttpRequest |
getRequest()
Get the request. |
HttpResponse |
getResponse()
Get the response. |
java.lang.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(java.io.OutputStream out,
int action,
java.lang.Object ignoredData)
Output Notifications. |
void |
setHttpTunnel(HttpTunnel tunnel)
Set a HttpTunnel for the connection. |
void |
setObject(java.lang.Object o)
Set associated object. |
void |
setThrottled(boolean throttled)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public HttpConnection(HttpListener listener, java.net.InetAddress remoteAddr, java.io.InputStream in, java.io.OutputStream out, java.lang.Object connection)
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().Method Detail |
public java.net.InetAddress getRemoteInetAddress()
public java.lang.String getRemoteAddr()
public java.lang.String getRemoteHost()
public HttpInputStream getInputStream()
public HttpOutputStream getOutputStream()
public java.lang.Object getConnection()
public HttpRequest getRequest()
public HttpResponse getResponse()
public void forceClose()
public void close() throws java.io.IOException
java.io.IOException
public HttpListener getListener()
public HttpServer getHttpServer()
public java.lang.String getDefaultScheme()
public java.lang.String getServerName()
public int getServerPort()
public boolean isThrottled()
public void setThrottled(boolean throttled)
throttled
- True if this connections state has been altered due
to low resources.public java.lang.Object getObject()
public void setObject(java.lang.Object o)
o
- An object associated with the connecton.public HttpTunnel getHttpTunnel()
public void setHttpTunnel(HttpTunnel tunnel)
tunnel
- The HttpTunnel set for the connection or null.public void outputNotify(java.io.OutputStream out, int action, java.lang.Object ignoredData) throws java.io.IOException
outputNotify
in interface OutputObserver
out
- The output stream observed.action
- The action.ignoredData
- Data associated with the event.
java.io.IOException
HttpOutputStream
public final void handle()
public boolean handleNext()
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |