Build 1.0_r1(from source)

org.apache.http.impl
Class SocketHttpServerConnection

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

public class SocketHttpServerConnection
extends AbstractHttpServerConnection
implements HttpInetConnection

Implementation of a server-side HTTP connection that can be bound to a network Socket in order to receive and transmit data.

Since:
4.0

Constructor Summary
SocketHttpServerConnection()
           
 
Method Summary
protected  void assertNotOpen()
           
protected  void assertOpen()
           
protected  void bind(Socket socket, HttpParams params)
           
 void close()
          Closes this connection gracefully.
protected  SessionInputBuffer createHttpDataReceiver(Socket socket, int buffersize, HttpParams params)
           
protected  SessionOutputBuffer createHttpDataTransmitter(Socket socket, int buffersize, HttpParams params)
           
 InetAddress getLocalAddress()
           
 int getLocalPort()
           
 InetAddress getRemoteAddress()
           
 int getRemotePort()
           
protected  Socket getSocket()
           
 int getSocketTimeout()
          Returns the socket timeout value.
 boolean isOpen()
          Checks if this connection is open.
 void setSocketTimeout(int timeout)
          Sets the socket timeout value.
 void shutdown()
          Force-closes this connection.
 
Methods inherited from class org.apache.http.impl.AbstractHttpServerConnection
createEntityDeserializer, createEntitySerializer, createHttpRequestFactory, createRequestParser, createResponseWriter, doFlush, flush, getMetrics, init, isStale, receiveRequestEntity, receiveRequestHeader, sendResponseEntity, sendResponseHeader
 
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
getMetrics, isStale
 

Constructor Detail

SocketHttpServerConnection

public SocketHttpServerConnection()
Method Detail

assertNotOpen

protected void assertNotOpen()

assertOpen

protected void assertOpen()
Specified by:
assertOpen in class AbstractHttpServerConnection

createHttpDataReceiver

protected SessionInputBuffer createHttpDataReceiver(Socket socket,
                                                    int buffersize,
                                                    HttpParams params)
                                             throws IOException
Throws:
IOException

createHttpDataTransmitter

protected SessionOutputBuffer createHttpDataTransmitter(Socket socket,
                                                        int buffersize,
                                                        HttpParams params)
                                                 throws IOException
Throws:
IOException

bind

protected void bind(Socket socket,
                    HttpParams params)
             throws IOException
Throws:
IOException

getSocket

protected Socket getSocket()

isOpen

public boolean isOpen()
Description copied from interface: HttpConnection
Checks if this connection is open.

Specified by:
isOpen in interface HttpConnection
Returns:
true if it is open, false if it is closed.

getLocalAddress

public InetAddress getLocalAddress()
Specified by:
getLocalAddress in interface HttpInetConnection

getLocalPort

public int getLocalPort()
Specified by:
getLocalPort in interface HttpInetConnection

getRemoteAddress

public InetAddress getRemoteAddress()
Specified by:
getRemoteAddress in interface HttpInetConnection

getRemotePort

public int getRemotePort()
Specified by:
getRemotePort in interface HttpInetConnection

setSocketTimeout

public void setSocketTimeout(int timeout)
Description copied from interface: HttpConnection
Sets the socket timeout value.

Specified by:
setSocketTimeout in interface HttpConnection
Parameters:
timeout - timeout value in milliseconds

getSocketTimeout

public int getSocketTimeout()
Description copied from interface: HttpConnection
Returns the socket timeout value.

Specified by:
getSocketTimeout in interface HttpConnection
Returns:
positive value in milliseconds if a timeout is set, 0 if timeout is disabled or -1 if timeout is undefined.

shutdown

public void shutdown()
              throws IOException
Description copied from interface: HttpConnection
Force-closes this connection. This is the only method of a connection which may be called from a different thread to terminate the connection. This method will not attempt to flush the transmitter's internal buffer prior to closing the underlying socket.

Specified by:
shutdown in interface HttpConnection
Throws:
IOException

close

public void close()
           throws IOException
Description copied from interface: HttpConnection
Closes this connection gracefully. This method will attempt to flush the transmitter's internal buffer prior to closing the underlying socket. This method MUST NOT be called from a different thread to force shutdown of the connection. Use shutdown instead.

Specified by:
close in interface HttpConnection
Throws:
IOException

Build 1.0_r1(from source)

Please submit a feedback, bug or feature