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) |
Modifier and Type | Method and Description |
---|---|
void |
abort(Throwable failure)
Aborts this transport.
|
void |
asyncReadFillInterested() |
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 |
isRequestBufferEmpty() |
protected org.eclipse.jetty.server.HttpChannelOverHttp |
newHttpChannel() |
protected HttpGenerator |
newHttpGenerator() |
protected HttpParser |
newHttpParser() |
protected HttpParser.RequestHandler |
newRequestHandler() |
void |
onClose()
Callback method invoked when this
Connection is closed. |
void |
onCompleted() |
void |
onFillable()
Callback method invoked when the endpoint is ready to be read.
|
protected void |
onFillInterestedFailed(Throwable cause)
Callback method invoked when the endpoint failed to be ready to be read.
|
void |
onOpen() |
ByteBuffer |
onUpgradeFrom()
Take the input buffer from the connection on upgrade.
|
void |
push(MetaData.Request request) |
void |
run() |
void |
send(MetaData.Response info,
boolean head,
ByteBuffer content,
boolean lastContent,
Callback callback) |
protected static HttpConnection |
setCurrentConnection(HttpConnection connection) |
String |
toString() |
addListener, close, failedCallback, fillInterested, getBytesIn, getBytesOut, getCreatedTimeStamp, getEndPoint, getExecutor, getInputBufferSize, isDispatchIO, isFillInterested, onReadTimeout, setInputBufferSize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addListener, close, getBytesIn, getBytesOut, getCreatedTimeStamp, getEndPoint
public static final HttpField CONNECTION_CLOSE
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 org.eclipse.jetty.server.HttpChannelOverHttp newHttpChannel()
protected HttpParser newHttpParser()
protected HttpParser.RequestHandler newRequestHandler()
public Server getServer()
public Connector getConnector()
public HttpChannel getHttpChannel()
public HttpParser getParser()
public HttpGenerator getGenerator()
public boolean isOptimizedForDirectBuffers()
HttpTransport
isOptimizedForDirectBuffers
in interface HttpTransport
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()
Connection.UpgradeFrom
This method is used to take any unconsumed input from a connection during an upgrade.
onUpgradeFrom
in interface Connection.UpgradeFrom
public ByteBuffer getRequestBuffer()
public boolean isRequestBufferEmpty()
public void onFillable()
AbstractConnection
Callback method invoked when the endpoint is ready to be read.
onFillable
in class AbstractConnection
AbstractConnection.fillInterested()
protected boolean fillAndParseForContent()
HttpParser.RequestHandler
method was called and it returned true;public void onCompleted()
onCompleted
in interface HttpTransport
protected void onFillInterestedFailed(Throwable cause)
AbstractConnection
Callback method invoked when the endpoint failed to be ready to be read.
onFillInterestedFailed
in class AbstractConnection
cause
- the exception that caused the failurepublic void onOpen()
onOpen
in interface Connection
onOpen
in class AbstractConnection
public void onClose()
Connection
Callback method invoked when this Connection
is closed.
Creators of the connection implementation are responsible for calling this method.
onClose
in interface Connection
onClose
in class AbstractConnection
public void send(MetaData.Response info, boolean head, ByteBuffer content, boolean lastContent, Callback callback)
send
in interface HttpTransport
public void abort(Throwable failure)
HttpTransport
This 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.
abort
in interface HttpTransport
failure
- the failure that caused the abort.public boolean isPushSupported()
isPushSupported
in interface HttpTransport
public void push(MetaData.Request request)
push
in interface HttpTransport
HttpTransport.push(org.eclipse.jetty.http.MetaData.Request)
public void asyncReadFillInterested()
public void blockingReadFillInterested()
public String toString()
toString
in class AbstractConnection
Copyright © 1995-2015 Webtide. All Rights Reserved.