| java.lang.Object org.w3c.www.protocol.http.HttpConnection org.w3c.www.protocol.http.HttpBasicConnection
Constructor Summary | |
| HttpBasicConnection(HttpServer server, int id, InetAddress addr, int port, int timeout, MimeParserFactory reply_factory) Create a new connection. | | HttpBasicConnection(HttpServer server, int id, InetAddress addr, int port, int timeout, int connect_timeout, MimeParserFactory reply_factory) Create a new connection. |
Method Summary | |
public synchronized void | close() Close this connection to terminate it. | protected synchronized void | detach() Used only when we can't evaluate the end of the connection. | public void | finalize() | public OutputStream | getOutputStream() Get the connection output stream. | public MimeParser | getParser() Get the MIME parser to read from this connection. | public void | markIdle(boolean close) The connection is now idle again.
Mark the connection as idle, and register it to the server's list of
idle connection (if this connection can be reused). | public boolean | markUsed() Mark this connection as being used.
The server, which keeps track of idle connections, has decided to use
this connection to run some request. | protected boolean | mayReuse() | public synchronized void | notifyClose(InputStream in) The entity stream we observe has been closed. | public synchronized void | notifyEOF(InputStream in) The entity stream we observe has reached its end. | public synchronized void | notifyFailure(InputStream in) The entity stream we were to observe refuse to be observed. | public void | notifyInputAvailable(InputStream in) Some data available on input, while writing to the server. | protected synchronized void | setCloseOnEOF(boolean doit) | public String | toString() Print this connection into a String. |
closeOnEOF | protected boolean closeOnEOF(Code) | | if a close is needed at the end of the connection (ie: on a
Connection: close client or server side
|
connect_timeout | int connect_timeout(Code) | | The Connection timeout for the underlying socket
|
id | protected int id(Code) | | All connections are associated with a uniq identifier, for debugging.
|
old_th | protected Thread old_th(Code) | | Old thread (same thread will try to reuse the same connection)
|
parser | MimeParser parser(Code) | | The MIME parser to read input from the connection.
|
port | int port(Code) | | The target port number for this connection.
|
th | Thread th(Code) | | The thread that owns the connection, for checking assertions.
|
timeout | int timeout(Code) | | The Timout on the underlying socket
|
close | public synchronized void close()(Code) | | Close this connection to terminate it.
This method will only close the streams, and free all the data
structures that it keeps.
|
detach | protected synchronized void detach()(Code) | | Used only when we can't evaluate the end of the connection.
In that case, we are just unregistering it, and wait for the GC
to clean the mess afterwards.
This method will not close the stream, but will free all the data
structures that it keeps to help the GC.
|
finalize | public void finalize()(Code) | | |
getOutputStream | public OutputStream getOutputStream()(Code) | | Get the connection output stream.
The output stream to send data on this connection. exception: RuntimeException - If the connection was not previously opened. |
getParser | public MimeParser getParser()(Code) | | Get the MIME parser to read from this connection.
All access to the connection's input stream should go through the MIME
parser to ensure buffering coherency.
A MimeParser instance suitable to parse the reply input stream. exception: RuntimeException - If the connection was not connected. |
markIdle | public void markIdle(boolean close)(Code) | | The connection is now idle again.
Mark the connection as idle, and register it to the server's list of
idle connection (if this connection can be reused). If the connection
cannot be reused, detach it from the server and forget about it (the
caller will close it by closing the entity stream).
Parameters: close - Should this connection be physically closed (it is notreusable), or should we try to keep track of it for later reuse. exception: RuntimeException - If the connection is in an invalid state. |
markUsed | public boolean markUsed()(Code) | | Mark this connection as being used.
The server, which keeps track of idle connections, has decided to use
this connection to run some request. Mark this connection as used
and unregister it from the server's list of idle connections.
Some assumptions are checked before handing out the connection
for use, which can throw an RuntimeException.
A boolean, true if the connection can be usedor reused, false otherwise (the connection was detectedidle, and destroy itself). exception: RuntimeException - If the connection is in an invalid state. |
mayReuse | protected boolean mayReuse()(Code) | | Can this connection be reused as a first choice when requested?
This is only a hint, as if all connections fail, the first one will
be forced by default
a boolean, true by default |
notifyClose | public synchronized void notifyClose(InputStream in)(Code) | | The entity stream we observe has been closed.
After making sure the entire entity has been read, we can safely hand
out the connection to the server, for later reuse.
Parameters: in - The stream that has been closed. |
notifyEOF | public synchronized void notifyEOF(InputStream in)(Code) | | The entity stream we observe has reached its end.
Notify the server that it can now reuse the connection safely for some
other pending requests.
Parameters: in - The stream that has reached its end of file. |
notifyFailure | public synchronized void notifyFailure(InputStream in)(Code) | | The entity stream we were to observe refuse to be observed.
The connection will not be reusable, so we should detach it from the
managing server, without closing it, since the entity reader will
close it itself.
Parameters: in - The stream that has been closed. |
notifyInputAvailable | public void notifyInputAvailable(InputStream in)(Code) | | Some data available on input, while writing to the server.
This callback gets called when the client is emitting data to the
server and the server has sent us something before we actually sent
all our bytes.
Take any appropriate action.
|
setCloseOnEOF | protected synchronized void setCloseOnEOF(boolean doit)(Code) | | |
toString | public String toString()(Code) | | Print this connection into a String.
A String containing the external representation for the connection. |
|
|