public class HttpConnection extends AbstractConnection implements Runnable, HttpTransport, Connection.UpgradeFrom
A Connection that handles the HTTP protocol.
Connection.Listener, Connection.UpgradeFrom, Connection.UpgradeTo| Modifier and Type | Field and Description |
|---|---|
static HttpField |
CONNECTION_CLOSE |
static String |
UPGRADE_CONNECTION_ATTRIBUTE |
| Constructor and Description |
|---|
HttpConnection(HttpConfiguration config,
Connector connector,
EndPoint endPoint,
HttpCompliance compliance,
boolean recordComplianceViolations) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort(Throwable failure)
Aborts this transport.
|
void |
asyncReadFillInterested() |
void |
blockingReadException(Throwable e) |
void |
blockingReadFillInterested() |
protected boolean |
fillAndParseForContent()
Fill and parse data looking for content
|
Connector |
getConnector() |
static HttpConnection |
getCurrentConnection()
Get the current connection that this thread is dispatched to.
|
HttpGenerator |
getGenerator() |
HttpChannel |
getHttpChannel() |
HttpConfiguration |
getHttpConfiguration() |
int |
getMessagesIn() |
int |
getMessagesOut() |
HttpParser |
getParser() |
ByteBuffer |
getRequestBuffer() |
Server |
getServer() |
boolean |
isOptimizedForDirectBuffers()
Is the underlying transport optimized for DirectBuffer usage
|
boolean |
isPushSupported() |
boolean |
isRecordHttpComplianceViolations() |
boolean |
isRequestBufferEmpty() |
protected HttpChannelOverHttp |
newHttpChannel() |
protected HttpGenerator |
newHttpGenerator() |
protected HttpParser |
newHttpParser(HttpCompliance compliance) |
protected HttpParser.RequestHandler |
newRequestHandler() |
void |
onClose() |
void |
onCompleted()
Called to indicated the end of the current request/response cycle (which may be
some time after the last content is sent).
|
void |
onFillable() |
protected void |
onFillInterestedFailed(Throwable cause) |
void |
onOpen() |
ByteBuffer |
onUpgradeFrom() |
void |
push(MetaData.Request request) |
void |
run() |
void |
send(MetaData.Response info,
boolean head,
ByteBuffer content,
boolean lastContent,
Callback callback)
Asynchronous call to send a response (or part) over the transport
|
protected static HttpConnection |
setCurrentConnection(HttpConnection connection) |
String |
toString() |
addListener, close, failedCallback, fillInterested, getBytesIn, getBytesOut, getCreatedTimeStamp, getEndPoint, getExecutor, getInputBufferSize, isDispatchIO, isFillInterested, onIdleExpired, onReadTimeout, removeListener, setInputBufferSize, tryFillInterested, tryFillInterestedclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddListener, close, getBytesIn, getBytesOut, getCreatedTimeStamp, getEndPoint, onIdleExpired, removeListenerpublic static final HttpField CONNECTION_CLOSE
public static final String UPGRADE_CONNECTION_ATTRIBUTE
public HttpConnection(HttpConfiguration config, Connector connector, EndPoint endPoint, HttpCompliance compliance, boolean recordComplianceViolations)
public static HttpConnection getCurrentConnection()
for a more general way to access the HttpConnectionprotected static HttpConnection setCurrentConnection(HttpConnection connection)
public HttpConfiguration getHttpConfiguration()
public boolean isRecordHttpComplianceViolations()
protected HttpGenerator newHttpGenerator()
protected HttpChannelOverHttp newHttpChannel()
protected HttpParser newHttpParser(HttpCompliance compliance)
protected HttpParser.RequestHandler newRequestHandler()
public Server getServer()
public Connector getConnector()
public HttpChannel getHttpChannel()
public HttpParser getParser()
public HttpGenerator getGenerator()
public boolean isOptimizedForDirectBuffers()
HttpTransportisOptimizedForDirectBuffers in interface HttpTransportpublic int getMessagesIn()
getMessagesIn in interface ConnectiongetMessagesIn in class AbstractConnectionpublic int getMessagesOut()
getMessagesOut in interface ConnectiongetMessagesOut in class AbstractConnectionpublic ByteBuffer onUpgradeFrom()
onUpgradeFrom in interface Connection.UpgradeFrompublic ByteBuffer getRequestBuffer()
public boolean isRequestBufferEmpty()
public void onFillable()
onFillable in class AbstractConnectionprotected boolean fillAndParseForContent()
HttpParser.RequestHandler method was called and it returned true;public void onCompleted()
HttpTransportonCompleted in interface HttpTransportprotected void onFillInterestedFailed(Throwable cause)
onFillInterestedFailed in class AbstractConnectionpublic void onOpen()
onOpen in interface ConnectiononOpen in class AbstractConnectionpublic void onClose()
onClose in interface ConnectiononClose in class AbstractConnectionpublic void send(MetaData.Response info, boolean head, ByteBuffer content, boolean lastContent, Callback callback)
HttpTransportsend in interface HttpTransportinfo - The header info to send, or null if just sending more data.
The first call to send for a response must have a non null info.head - True if the response if for a HEAD request (and the data should not be sent).content - A buffer of content to be sent.lastContent - True if the content is the last content for the current response.callback - The Callback instance that success or failure of the send is notified onpublic void abort(Throwable failure)
HttpTransportThis method should terminate the transport in a way that can indicate an abnormal response to the client, for example by abruptly close the connection.
This method is called when an error response needs to be sent,
but the response is already committed, or when a write failure
is detected. If abort is called, HttpTransport.onCompleted() is not
called
abort in interface HttpTransportfailure - the failure that caused the abort.public boolean isPushSupported()
isPushSupported in interface HttpTransportpublic void push(MetaData.Request request)
push in interface HttpTransportrequest - A request to use as the basis for generating a pushed response.public void asyncReadFillInterested()
public void blockingReadFillInterested()
public void blockingReadException(Throwable e)
public String toString()
toString in class AbstractConnectionCopyright © 1995–2017 Webtide. All rights reserved.