public class HttpConnection extends AbstractConnection implements Runnable, HttpTransport
A Connection that handles the HTTP protocol.
| Modifier and Type | Class and Description |
|---|---|
protected class |
HttpConnection.HttpChannelOverHttp |
AbstractConnection.FillingInterestedCallback, AbstractConnection.NestedState, AbstractConnection.StateConnection.Listener| 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) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Abort transport.
|
void |
completed() |
Connector |
getConnector() |
static HttpConnection |
getCurrentConnection()
Get the current connection that this thread is dispatched to.
|
HttpChannel<?> |
getHttpChannel() |
HttpConfiguration |
getHttpConfiguration() |
int |
getMessagesIn() |
int |
getMessagesOut() |
HttpParser |
getParser() |
ByteBuffer |
getRequestBuffer() |
Server |
getServer() |
protected HttpConnection.HttpChannelOverHttp |
newHttpChannel(HttpInput<ByteBuffer> httpInput) |
protected HttpGenerator |
newHttpGenerator() |
protected HttpInput<ByteBuffer> |
newHttpInput() |
protected HttpParser |
newHttpParser() |
protected HttpParser.RequestHandler<ByteBuffer> |
newRequestHandler() |
void |
onClose()
Callback method invoked when this
Connection is closed. |
void |
onFillable()
Parses and handles HTTP messages.
|
protected void |
onFillInterestedFailed(Throwable cause)
Callback method invoked when the endpoint failed to be ready to be read.
|
void |
onOpen()
Callback method invoked when this
Connection is opened. |
protected void |
parseContent()
Fill and parse data looking for content
|
void |
run() |
void |
send(ByteBuffer content,
boolean lastContent,
Callback callback) |
void |
send(HttpGenerator.ResponseInfo info,
ByteBuffer content,
boolean lastContent,
Callback callback) |
protected static HttpConnection |
setCurrentConnection(HttpConnection connection) |
addListener, close, failedCallback, fillInterested, fillInterested, getBytesIn, getBytesOut, getCreatedTimeStamp, getEndPoint, getExecutor, getInputBufferSize, next, onReadTimeout, setInputBufferSize, toStringpublic 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 HttpConnectionprotected 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 ConnectiongetMessagesIn in class AbstractConnectionpublic int getMessagesOut()
getMessagesOut in interface ConnectiongetMessagesOut in class AbstractConnectionpublic 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 AbstractConnectionAbstractConnection.fillInterested()protected void parseContent()
throws IOException
IOExceptionpublic void completed()
completed in interface HttpTransportprotected void onFillInterestedFailed(Throwable cause)
AbstractConnectionCallback method invoked when the endpoint failed to be ready to be read.
onFillInterestedFailed in class AbstractConnectioncause - the exception that caused the failurepublic void onOpen()
ConnectionCallback method invoked when this Connection is opened.
Creators of the connection implementation are responsible for calling this method.
onOpen in interface ConnectiononOpen in class AbstractConnectionpublic void onClose()
ConnectionCallback method invoked when this Connection is closed.
Creators of the connection implementation are responsible for calling this method.
onClose in interface ConnectiononClose in class AbstractConnectionpublic void send(HttpGenerator.ResponseInfo info, ByteBuffer content, boolean lastContent, Callback callback)
send in interface HttpTransportpublic void send(ByteBuffer content, boolean lastContent, Callback callback)
send in interface HttpTransportpublic void abort()
HttpTransportabort in interface HttpTransportCopyright © 1995-2015 Webtide. All Rights Reserved.