Build 1.0_r1(from source)

org.apache.http.impl
Class AbstractHttpServerConnection

java.lang.Object
  extended by org.apache.http.impl.AbstractHttpServerConnection
All Implemented Interfaces:
HttpConnection, HttpServerConnection
Direct Known Subclasses:
SocketHttpServerConnection

public abstract class AbstractHttpServerConnection
extends Object
implements HttpServerConnection

Abstract server-side HTTP connection capable of transmitting and receiving data using arbitrary SessionInputBuffer and SessionOutputBuffer

Since:
4.0

Constructor Summary
AbstractHttpServerConnection()
           
 
Method Summary
protected abstract  void assertOpen()
           
protected  EntityDeserializer createEntityDeserializer()
           
protected  EntitySerializer createEntitySerializer()
           
protected  HttpRequestFactory createHttpRequestFactory()
           
protected  HttpMessageParser createRequestParser(SessionInputBuffer buffer, HttpRequestFactory requestFactory, HttpParams params)
           
protected  HttpMessageWriter createResponseWriter(SessionOutputBuffer buffer, HttpParams params)
           
protected  void doFlush()
           
 void flush()
          Sends all pending buffered data over this connection.
 HttpConnectionMetrics getMetrics()
          Returns a collection of connection metrcis
protected  void init(SessionInputBuffer inbuffer, SessionOutputBuffer outbuffer, HttpParams params)
           
 boolean isStale()
          Checks whether this connection has gone down.
 void receiveRequestEntity(HttpEntityEnclosingRequest request)
          Receives the next request entity available from this connection and attaches it to an existing request.
 HttpRequest receiveRequestHeader()
          Receives the request line and all headers available from this connection.
 void sendResponseEntity(HttpResponse response)
          Sends the response entity of a response over this connection.
 void sendResponseHeader(HttpResponse response)
          Sends the response line and headers of a response over this connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.http.HttpConnection
close, getSocketTimeout, isOpen, setSocketTimeout, shutdown
 

Constructor Detail

AbstractHttpServerConnection

public AbstractHttpServerConnection()
Method Detail

assertOpen

protected abstract void assertOpen()
                            throws IllegalStateException
Throws:
IllegalStateException

createEntityDeserializer

protected EntityDeserializer createEntityDeserializer()

createEntitySerializer

protected EntitySerializer createEntitySerializer()

createHttpRequestFactory

protected HttpRequestFactory createHttpRequestFactory()

createRequestParser

protected HttpMessageParser createRequestParser(SessionInputBuffer buffer,
                                                HttpRequestFactory requestFactory,
                                                HttpParams params)

createResponseWriter

protected HttpMessageWriter createResponseWriter(SessionOutputBuffer buffer,
                                                 HttpParams params)

init

protected void init(SessionInputBuffer inbuffer,
                    SessionOutputBuffer outbuffer,
                    HttpParams params)

receiveRequestHeader

public HttpRequest receiveRequestHeader()
                                 throws HttpException,
                                        IOException
Description copied from interface: HttpServerConnection
Receives the request line and all headers available from this connection. The caller should examine the returned request and decide if to receive a request entity as well.

Specified by:
receiveRequestHeader in interface HttpServerConnection
Returns:
a new HttpRequest object whose request line and headers are initialized.
Throws:
HttpException
IOException

receiveRequestEntity

public void receiveRequestEntity(HttpEntityEnclosingRequest request)
                          throws HttpException,
                                 IOException
Description copied from interface: HttpServerConnection
Receives the next request entity available from this connection and attaches it to an existing request.

Specified by:
receiveRequestEntity in interface HttpServerConnection
Parameters:
request - the request to attach the entity to.
Throws:
HttpException
IOException

doFlush

protected void doFlush()
                throws IOException
Throws:
IOException

flush

public void flush()
           throws IOException
Description copied from interface: HttpServerConnection
Sends all pending buffered data over this connection.

Specified by:
flush in interface HttpServerConnection
Throws:
IOException

sendResponseHeader

public void sendResponseHeader(HttpResponse response)
                        throws HttpException,
                               IOException
Description copied from interface: HttpServerConnection
Sends the response line and headers of a response over this connection.

Specified by:
sendResponseHeader in interface HttpServerConnection
Parameters:
response - the response whose headers to send.
Throws:
HttpException
IOException

sendResponseEntity

public void sendResponseEntity(HttpResponse response)
                        throws HttpException,
                               IOException
Description copied from interface: HttpServerConnection
Sends the response entity of a response over this connection.

Specified by:
sendResponseEntity in interface HttpServerConnection
Parameters:
response - the response whose entity to send.
Throws:
HttpException
IOException

isStale

public boolean isStale()
Description copied from interface: HttpConnection
Checks whether this connection has gone down. Network connections may get closed during some time of inactivity for several reasons. The next time a read is attempted on such a connection it will throw an IOException. This method tries to alleviate this inconvenience by trying to find out if a connection is still usable. Implementations may do that by attempting a read with a very small timeout. Thus this method may block for a small amount of time before returning a result. It is therefore an expensive operation.

Specified by:
isStale in interface HttpConnection
Returns:
true if attempts to use this connection are likely to succeed, or false if they are likely to fail and this connection should be closed

getMetrics

public HttpConnectionMetrics getMetrics()
Description copied from interface: HttpConnection
Returns a collection of connection metrcis

Specified by:
getMetrics in interface HttpConnection
Returns:
HttpConnectionMetrics

Build 1.0_r1(from source)

Please submit a feedback, bug or feature