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

Since: API Level 1

Public Methods

public void flush ()

Since: API Level 1

Sends all pending buffered data over this connection.

Throws
IOException

public HttpConnectionMetrics getMetrics ()

Since: API Level 1

Returns a collection of connection metrcis

Returns
  • HttpConnectionMetrics

public boolean isStale ()

Since: API Level 1

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)

Since: API Level 1

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

Since: API Level 1

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)

Since: API Level 1

Sends the response entity of a response over this connection.

Parameters
response the response whose entity to send.

public void sendResponseHeader (HttpResponse response)

Since: API Level 1

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

Since: API Level 1

protected EntityDeserializer createEntityDeserializer ()

Since: API Level 1

protected EntitySerializer createEntitySerializer ()

Since: API Level 1

protected HttpRequestFactory createHttpRequestFactory ()

Since: API Level 1

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

Since: API Level 1

protected HttpMessageWriter createResponseWriter (SessionOutputBuffer buffer, HttpParams params)

Since: API Level 1

protected void doFlush ()

Since: API Level 1

Throws
IOException

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

Since: API Level 1