public class HttpConnection extends AbstractConnection implements Runnable, HttpTransport, Connection.UpgradeFrom
A Connection
that handles the HTTP protocol.
Modifier and Type | Class and Description |
---|---|
protected class |
HttpConnection.HttpChannelOverHttp |
AbstractConnection.FillingInterestedCallback, AbstractConnection.NestedState, AbstractConnection.State
Connection.Listener, Connection.UpgradeFrom, Connection.UpgradeTo
Modifier and Type | Field and Description |
---|---|
static String |
UPGRADE_CONNECTION_ATTRIBUTE |
EXECUTE_ONFILLABLE, FILL_INTERESTED, FILLING, FILLING_FILL_INTERESTED, IDLE, REFILLING
Constructor and Description |
---|
HttpConnection(HttpConfiguration config,
Connector connector,
EndPoint endPoint) |
addListener, close, failedCallback, fillInterested, fillInterested, getBytesIn, getBytesOut, getCreatedTimeStamp, getEndPoint, getExecutor, getInputBufferSize, next, onReadTimeout, setInputBufferSize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addListener, close, getBytesIn, getBytesOut, getCreatedTimeStamp, getEndPoint
public static final String UPGRADE_CONNECTION_ATTRIBUTE
public HttpConnection(HttpConfiguration config, Connector connector, EndPoint endPoint)
public static HttpConnection getCurrentConnection()
for a more general way to access the HttpConnection
protected static HttpConnection setCurrentConnection(HttpConnection connection)
public HttpConfiguration getHttpConfiguration()
protected HttpGenerator newHttpGenerator()
protected HttpInput<ByteBuffer> newHttpInput()
protected HttpConnection.HttpChannelOverHttp newHttpChannel(HttpInput<ByteBuffer> httpInput)
protected HttpParser newHttpParser()
protected HttpParser.RequestHandler<ByteBuffer> newRequestHandler()
public Server getServer()
public Connector getConnector()
public HttpChannel<?> getHttpChannel()
public HttpParser getParser()
public int getMessagesIn()
getMessagesIn
in interface Connection
getMessagesIn
in class AbstractConnection
public int getMessagesOut()
getMessagesOut
in interface Connection
getMessagesOut
in class AbstractConnection
public ByteBuffer onUpgradeFrom()
onUpgradeFrom
in interface Connection.UpgradeFrom
public ByteBuffer getRequestBuffer()
public void onFillable()
Parses and handles HTTP messages.
This method is called when this Connection
is ready to read bytes from the EndPoint
.
However, it can also be called if there is unconsumed data in the _requestBuffer, as a result of
resuming a suspended request when there is a pipelined request already read into the buffer.
This method fills bytes and parses them until either: EOF is filled; 0 bytes are filled; the HttpChannel finishes handling; or the connection has changed.
onFillable
in class AbstractConnection
protected void parseContent() throws IOException
IOException
public void completed()
completed
in interface HttpTransport
protected void onFillInterestedFailed(Throwable cause)
onFillInterestedFailed
in class AbstractConnection
public void onOpen()
onOpen
in interface Connection
onOpen
in class AbstractConnection
public void onClose()
onClose
in interface Connection
onClose
in class AbstractConnection
public void send(HttpGenerator.ResponseInfo info, ByteBuffer content, boolean lastContent, Callback callback)
send
in interface HttpTransport
public void send(ByteBuffer content, boolean lastContent, Callback callback)
send
in interface HttpTransport
public void abort()
HttpTransport
abort
in interface HttpTransport
public String toString()
toString
in class AbstractConnection
Copyright © 1995-2016 Webtide. All Rights Reserved.