public abstract class

AbstractHttpServerConnection

extends Object
implements HttpServerConnection
java.lang.Object
   ↳ org.apache.http.impl.AbstractHttpServerConnection
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

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

Summary

Public Constructors
AbstractHttpServerConnection()
Public Methods
void flush()
Sends all pending buffered data over this connection.
HttpConnectionMetrics getMetrics()
Returns a collection of connection metrcis
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.
Protected Methods
abstract void assertOpen()
EntityDeserializer createEntityDeserializer()
EntitySerializer createEntitySerializer()
HttpRequestFactory createHttpRequestFactory()
HttpMessageParser createRequestParser(SessionInputBuffer buffer, HttpRequestFactory requestFactory, HttpParams params)
HttpMessageWriter createResponseWriter(SessionOutputBuffer buffer, HttpParams params)
void doFlush()
void init(SessionInputBuffer inbuffer, SessionOutputBuffer outbuffer, HttpParams params)
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.http.HttpConnection
From interface org.apache.http.HttpServerConnection

Public Constructors

public AbstractHttpServerConnection ()

Public Methods

public void flush ()

Sends all pending buffered data over this connection.

Throws
IOException

public HttpConnectionMetrics getMetrics ()

Returns a collection of connection metrcis

Returns
  • HttpConnectionMetrics

public boolean isStale ()

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.

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

public void receiveRequestEntity (HttpEntityEnclosingRequest request)

Receives the next request entity available from this connection and attaches it to an existing request.

Parameters
request the request to attach the entity to.

public HttpRequest receiveRequestHeader ()

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.

Returns
  • a new HttpRequest object whose request line and headers are initialized.

public void sendResponseEntity (HttpResponse response)

Sends the response entity of a response over this connection.

Parameters
response the response whose entity to send.

public void sendResponseHeader (HttpResponse response)

Sends the response line and headers of a response over this connection.

Parameters
response the response whose headers to send.

Protected Methods

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 ()

Throws
IOException

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