org.apache.http.impl
Class DefaultBHttpServerConnection

java.lang.Object
  extended by org.apache.http.impl.BHttpConnectionBase
      extended by org.apache.http.impl.DefaultBHttpServerConnection
All Implemented Interfaces:
org.apache.http.HttpConnection, org.apache.http.HttpInetConnection, org.apache.http.HttpServerConnection

@NotThreadSafe
public class DefaultBHttpServerConnection
extends BHttpConnectionBase
implements org.apache.http.HttpServerConnection

Default implementation of HttpServerConnection.

Since:
4.3

Constructor Summary
DefaultBHttpServerConnection(int buffersize)
           
DefaultBHttpServerConnection(int buffersize, java.nio.charset.CharsetDecoder chardecoder, java.nio.charset.CharsetEncoder charencoder, MessageConstraints constraints)
           
DefaultBHttpServerConnection(int buffersize, int fragmentSizeHint, java.nio.charset.CharsetDecoder chardecoder, java.nio.charset.CharsetEncoder charencoder, MessageConstraints constraints, org.apache.http.entity.ContentLengthStrategy incomingContentStrategy, org.apache.http.entity.ContentLengthStrategy outgoingContentStrategy, HttpMessageParserFactory<org.apache.http.HttpRequest> requestParserFactory, HttpMessageWriterFactory<org.apache.http.HttpResponse> responseWriterFactory)
          Creates new instance of DefaultBHttpServerConnection.
 
Method Summary
 void bind(java.net.Socket socket)
          Binds this connection to the given Socket.
 void flush()
           
protected  void onRequestReceived(org.apache.http.HttpRequest request)
           
protected  void onResponseSubmitted(org.apache.http.HttpResponse response)
           
 void receiveRequestEntity(org.apache.http.HttpEntityEnclosingRequest request)
           
 org.apache.http.HttpRequest receiveRequestHeader()
           
 void sendResponseEntity(org.apache.http.HttpResponse response)
           
 void sendResponseHeader(org.apache.http.HttpResponse response)
           
 
Methods inherited from class org.apache.http.impl.BHttpConnectionBase
awaitInput, close, createInputStream, createOutputStream, doFlush, ensureOpen, getLocalAddress, getLocalPort, getMetrics, getRemoteAddress, getRemotePort, getSessionInputBuffer, getSessionOutputBuffer, getSocket, getSocketInputStream, getSocketOutputStream, getSocketTimeout, incrementRequestCount, incrementResponseCount, isOpen, isStale, prepareInput, prepareOutput, setSocketTimeout, shutdown, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.http.HttpConnection
close, getMetrics, getSocketTimeout, isOpen, isStale, setSocketTimeout, shutdown
 

Constructor Detail

DefaultBHttpServerConnection

public DefaultBHttpServerConnection(int buffersize,
                                    int fragmentSizeHint,
                                    java.nio.charset.CharsetDecoder chardecoder,
                                    java.nio.charset.CharsetEncoder charencoder,
                                    MessageConstraints constraints,
                                    org.apache.http.entity.ContentLengthStrategy incomingContentStrategy,
                                    org.apache.http.entity.ContentLengthStrategy outgoingContentStrategy,
                                    HttpMessageParserFactory<org.apache.http.HttpRequest> requestParserFactory,
                                    HttpMessageWriterFactory<org.apache.http.HttpResponse> responseWriterFactory)
Creates new instance of DefaultBHttpServerConnection.

Parameters:
buffersize - buffer size. Must be a positive number.
fragmentSizeHint - fragment size hint.
chardecoder - decoder to be used for decoding HTTP protocol elements. If null simple type cast will be used for byte to char conversion.
charencoder - encoder to be used for encoding HTTP protocol elements. If null simple type cast will be used for char to byte conversion.
constraints - Message constraints. If null MessageConstraints.DEFAULT will be used.
incomingContentStrategy - incoming content length strategy. If null DisallowIdentityContentLengthStrategy.INSTANCE will be used.
outgoingContentStrategy - outgoing content length strategy. If null StrictContentLengthStrategyHC4.INSTANCE will be used.
requestParserFactory - request parser factory. If null DefaultHttpRequestParserFactory.INSTANCE will be used.
responseWriterFactory - response writer factory. If null DefaultHttpResponseWriterFactory.INSTANCE will be used.

DefaultBHttpServerConnection

public DefaultBHttpServerConnection(int buffersize,
                                    java.nio.charset.CharsetDecoder chardecoder,
                                    java.nio.charset.CharsetEncoder charencoder,
                                    MessageConstraints constraints)

DefaultBHttpServerConnection

public DefaultBHttpServerConnection(int buffersize)
Method Detail

onRequestReceived

protected void onRequestReceived(org.apache.http.HttpRequest request)

onResponseSubmitted

protected void onResponseSubmitted(org.apache.http.HttpResponse response)

bind

public void bind(java.net.Socket socket)
          throws java.io.IOException
Description copied from class: BHttpConnectionBase
Binds this connection to the given Socket. This socket will be used by the connection to send and receive data.

After this method's execution the connection status will be reported as open and the BHttpConnectionBase.isOpen() will return true.

Overrides:
bind in class BHttpConnectionBase
Parameters:
socket - the socket.
Throws:
java.io.IOException - in case of an I/O error.

receiveRequestHeader

public org.apache.http.HttpRequest receiveRequestHeader()
                                                 throws org.apache.http.HttpException,
                                                        java.io.IOException
Specified by:
receiveRequestHeader in interface org.apache.http.HttpServerConnection
Throws:
org.apache.http.HttpException
java.io.IOException

receiveRequestEntity

public void receiveRequestEntity(org.apache.http.HttpEntityEnclosingRequest request)
                          throws org.apache.http.HttpException,
                                 java.io.IOException
Specified by:
receiveRequestEntity in interface org.apache.http.HttpServerConnection
Throws:
org.apache.http.HttpException
java.io.IOException

sendResponseHeader

public void sendResponseHeader(org.apache.http.HttpResponse response)
                        throws org.apache.http.HttpException,
                               java.io.IOException
Specified by:
sendResponseHeader in interface org.apache.http.HttpServerConnection
Throws:
org.apache.http.HttpException
java.io.IOException

sendResponseEntity

public void sendResponseEntity(org.apache.http.HttpResponse response)
                        throws org.apache.http.HttpException,
                               java.io.IOException
Specified by:
sendResponseEntity in interface org.apache.http.HttpServerConnection
Throws:
org.apache.http.HttpException
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface org.apache.http.HttpServerConnection
Throws:
java.io.IOException