Top Fields Constructors Methods
org.apache.http.impl

public Class SocketHttpServerConnection

extends AbstractHttpServerConnection
implements HttpInetConnection
Class Inheritance
All Implemented Interfaces
org.apache.http.HttpInetConnection, org.apache.http.HttpConnection, java.io.Closeable, java.lang.AutoCloseable
Known Direct Subclasses
org.apache.http.impl.DefaultHttpServerConnection
Annotations
@Deprecated
Imports
java.io.IOException, java.net.InetAddress, .InetSocketAddress, .Socket, .SocketAddress, .SocketException, org.apache.http.HttpInetConnection, org.apache.http.impl.io.SocketInputBuffer, .SocketOutputBuffer, org.apache.http.io.SessionInputBuffer, .SessionOutputBuffer, org.apache.http.params.CoreConnectionPNames, .HttpParams, org.apache.http.util.Args, .Asserts

Deprecated

Do not use.

Field Summary

Modifier and TypeField and Description
private volatile boolean
private volatile Socket

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
protected void
assertOpen()

Implements abstract org.apache.http.impl.AbstractHttpServerConnection.assertOpen.

Asserts if the connection is open.
protected void
bind(final Socket
the socket.
socket
,
final HttpParams
HTTP parameters.
params
)

Deprecated as a consequence of HttpParams being deprecated.
Binds this connection to the given Socket.
public void
close()

Implements org.apache.http.HttpConnection.close.

Closes this connection gracefully.
protected SessionInputBuffer

Returns:

session input buffer.
createSessionInputBuffer
(final Socket
the socket.
socket
,
final int
the buffer size.
bufferSize
,
final HttpParams
HTTP parameters.
params
)

Deprecated as a consequence of HttpParams being deprecated.
Creates an instance of SocketInputBuffer to be used for receiving data from the given Socket.
protected SessionOutputBuffer

Returns:

session output buffer.
createSessionOutputBuffer
(final Socket
the socket.
socket
,
final int
the buffer size.
bufferSize
,
final HttpParams
HTTP parameters.
params
)

Deprecated as a consequence of HttpParams being deprecated.
Creates an instance of SessionOutputBuffer to be used for sending data to the given Socket.
private static void
formatAddress(final StringBuilder buffer, final SocketAddress socketAddress)

public InetAddress
public int
public InetAddress
public int
protected Socket
public int
getSocketTimeout()

Implements org.apache.http.HttpConnection.getSocketTimeout.

Returns the socket timeout value.
public boolean
isOpen()

Implements org.apache.http.HttpConnection.isOpen.

Checks if this connection is open.
public void
setSocketTimeout(final int
timeout value in milliseconds
timeout
)

Implements org.apache.http.HttpConnection.setSocketTimeout.

Sets the socket timeout value.
public void
shutdown()

Implements org.apache.http.HttpConnection.shutdown.

Force-closes this connection.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from org.apache.http.impl.AbstractHttpServerConnection:
createConnectionMetricscreateEntityDeserializercreateEntitySerializercreateHttpRequestFactorycreateRequestParsercreateResponseWriterdoFlushflushgetMetricsinitisEofisStalereceiveRequestEntityreceiveRequestHeadersendResponseEntitysendResponseHeader

Field Detail

openback to summary
private volatile boolean open
socketback to summary
private volatile Socket socket

Constructor Detail

SocketHttpServerConnectionback to summary
public SocketHttpServerConnection()

Method Detail

assertNotOpenback to summary
protected void assertNotOpen()
assertOpenback to summary
protected void assertOpen()

Implements abstract org.apache.http.impl.AbstractHttpServerConnection.assertOpen.

Doc from org.apache.http.impl.AbstractHttpServerConnection.assertOpen.

Asserts if the connection is open.

Annotations
@Override
bindback to summary
protected void bind(final Socket socket, final HttpParams params) throws IOException

Deprecated

as a consequence of HttpParams being deprecated. See corresponding docs for further information.

Binds this connection to the given Socket. This socket will be used by the connection to send and receive data.

This method will invoke createSessionInputBuffer(Socket, int, HttpParams) and createSessionOutputBuffer(Socket, int, HttpParams) methods to create session input / output buffers bound to this socket and then will invoke init(SessionInputBuffer, SessionOutputBuffer, HttpParams) method to pass references to those buffers to the underlying HTTP message parser and formatter.

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

Parameters
socket:Socket

the socket.

params:HttpParams

HTTP parameters.

Exceptions
IOException:
in case of an I/O error.
closeback to summary
public void close() throws IOException

Implements org.apache.http.HttpConnection.close.

Doc from org.apache.http.HttpConnection.close.

Closes this connection gracefully. This method will attempt to flush the internal output 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.

Annotations
@Override
Exceptions
IOException:

Doc from java.io.Closeable.close.

if an I/O error occurs

createSessionInputBufferback to summary
protected SessionInputBuffer createSessionInputBuffer(final Socket socket, final int bufferSize, final HttpParams params) throws IOException

Deprecated

as a consequence of HttpParams being deprecated. See corresponding docs for further information.

Creates an instance of SocketInputBuffer to be used for receiving data from the given Socket.

This method can be overridden in a super class in order to provide a custom implementation of SessionInputBuffer interface.

Parameters
socket:Socket

the socket.

bufferSize:int

the buffer size.

params:HttpParams

HTTP parameters.

Returns:SessionInputBuffer

session input buffer.

Exceptions
IOException:
in case of an I/O error.
See Also
SocketInputBuffer#SocketInputBuffer(Socket, int, HttpParams)
createSessionOutputBufferback to summary
protected SessionOutputBuffer createSessionOutputBuffer(final Socket socket, final int bufferSize, final HttpParams params) throws IOException

Deprecated

as a consequence of HttpParams being deprecated. See corresponding docs for further information.

Creates an instance of SessionOutputBuffer to be used for sending data to the given Socket.

This method can be overridden in a super class in order to provide a custom implementation of SocketOutputBuffer interface.

Parameters
socket:Socket

the socket.

bufferSize:int

the buffer size.

params:HttpParams

HTTP parameters.

Returns:SessionOutputBuffer

session output buffer.

Exceptions
IOException:
in case of an I/O error.
See Also
SocketOutputBuffer#SocketOutputBuffer(Socket, int, HttpParams)
formatAddressback to summary
private static void formatAddress(final StringBuilder buffer, final SocketAddress socketAddress)
getLocalAddressback to summary
public InetAddress getLocalAddress()

Implements org.apache.http.HttpInetConnection.getLocalAddress.

Annotations
@Override
getLocalPortback to summary
public int getLocalPort()

Implements org.apache.http.HttpInetConnection.getLocalPort.

Annotations
@Override
getRemoteAddressback to summary
public InetAddress getRemoteAddress()

Implements org.apache.http.HttpInetConnection.getRemoteAddress.

Annotations
@Override
getRemotePortback to summary
public int getRemotePort()

Implements org.apache.http.HttpInetConnection.getRemotePort.

Annotations
@Override
getSocketback to summary
protected Socket getSocket()
getSocketTimeoutback to summary
public int getSocketTimeout()

Implements org.apache.http.HttpConnection.getSocketTimeout.

Doc from org.apache.http.HttpConnection.getSocketTimeout.

Returns the socket timeout value.

Returns:int

positive value in milliseconds if a timeout is set, 0 if timeout is disabled or -1 if timeout is undefined.

Annotations
@Override
isOpenback to summary
public boolean isOpen()

Implements org.apache.http.HttpConnection.isOpen.

Doc from org.apache.http.HttpConnection.isOpen.

Checks if this connection is open.

Returns:boolean

true if it is open, false if it is closed.

Annotations
@Override
setSocketTimeoutback to summary
public void setSocketTimeout(final int timeout)

Implements org.apache.http.HttpConnection.setSocketTimeout.

Doc from org.apache.http.HttpConnection.setSocketTimeout.

Sets the socket timeout value.

Parameters
timeout:int

timeout value in milliseconds

Annotations
@Override
shutdownback to summary
public void shutdown() throws IOException

Implements org.apache.http.HttpConnection.shutdown.

Doc from org.apache.http.HttpConnection.shutdown.

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.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override