java.lang.Object
org.eclipse.jetty.io.AbstractConnection
org.eclipse.jetty.server.HttpConnection
- All Implemented Interfaces:
Closeable,AutoCloseable,Runnable,org.eclipse.jetty.io.Connection,org.eclipse.jetty.io.Connection.UpgradeFrom,org.eclipse.jetty.io.Connection.UpgradeTo,org.eclipse.jetty.io.WriteFlusher.Listener,HttpTransport
public class HttpConnection
extends org.eclipse.jetty.io.AbstractConnection
implements Runnable, HttpTransport, org.eclipse.jetty.io.WriteFlusher.Listener, org.eclipse.jetty.io.Connection.UpgradeFrom, org.eclipse.jetty.io.Connection.UpgradeTo
A Connection that handles the HTTP protocol.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.Connection
org.eclipse.jetty.io.Connection.Listener, org.eclipse.jetty.io.Connection.UpgradeFrom, org.eclipse.jetty.io.Connection.UpgradeTo -
Field Summary
FieldsFields inherited from interface org.eclipse.jetty.server.HttpTransport
UPGRADE_CONNECTION_ATTRIBUTE -
Constructor Summary
ConstructorsConstructorDescriptionHttpConnection(HttpConfiguration config, Connector connector, org.eclipse.jetty.io.EndPoint endPoint, boolean recordComplianceViolations) -
Method Summary
Modifier and TypeMethodDescriptionvoidAborts this transport.voidlonglongstatic HttpConnectionGet the current connection that this thread is dispatched to.org.eclipse.jetty.http.HttpGeneratorlonglongorg.eclipse.jetty.http.HttpParserbooleanbooleanbooleanbooleanbooleanprotected HttpChannelOverHttpprotected org.eclipse.jetty.http.HttpGeneratorprotected org.eclipse.jetty.http.HttpParsernewHttpParser(org.eclipse.jetty.http.HttpCompliance compliance) protected org.eclipse.jetty.http.HttpParser.RequestHandlervoidvoidCalled to indicated the end of the current request/response cycle (which may be some time after the last content is sent).voidprotected voidonFillInterestedFailed(Throwable cause) voidonFlushed(long bytes) voidonOpen()protected booleanonReadTimeout(Throwable timeout) voidonUpgradeTo(ByteBuffer buffer) voidpush(org.eclipse.jetty.http.MetaData.Request request) voidrun()voidsend(org.eclipse.jetty.http.MetaData.Request request, org.eclipse.jetty.http.MetaData.Response response, ByteBuffer content, boolean lastContent, org.eclipse.jetty.util.Callback callback) Asynchronous call to send a response (or part) over the transportprotected static HttpConnectionsetCurrentConnection(HttpConnection connection) voidsetUseInputDirectByteBuffers(boolean useInputDirectByteBuffers) voidsetUseOutputDirectByteBuffers(boolean useOutputDirectByteBuffers) Methods inherited from class org.eclipse.jetty.io.AbstractConnection
addEventListener, close, failedCallback, fillInterested, getCreatedTimeStamp, getEndPoint, getExecutor, getInputBufferSize, isFillInterested, onIdleExpired, removeEventListener, setInputBufferSize, toString, tryFillInterested
-
Field Details
-
CONNECTION_CLOSE
public static final org.eclipse.jetty.http.HttpField CONNECTION_CLOSE
-
-
Constructor Details
-
HttpConnection
public HttpConnection(HttpConfiguration config, Connector connector, org.eclipse.jetty.io.EndPoint endPoint, boolean recordComplianceViolations)
-
-
Method Details
-
getCurrentConnection
Get the current connection that this thread is dispatched to. Note that a thread may be processing a request asynchronously and thus not be dispatched to the connection.- Returns:
- the current HttpConnection or null
- See Also:
-
setCurrentConnection
-
getHttpConfiguration
-
isRecordHttpComplianceViolations
public boolean isRecordHttpComplianceViolations() -
newHttpGenerator
protected org.eclipse.jetty.http.HttpGenerator newHttpGenerator() -
newHttpChannel
-
newHttpParser
protected org.eclipse.jetty.http.HttpParser newHttpParser(org.eclipse.jetty.http.HttpCompliance compliance) -
newRequestHandler
protected org.eclipse.jetty.http.HttpParser.RequestHandler newRequestHandler() -
getServer
-
getConnector
-
getHttpChannel
-
getParser
public org.eclipse.jetty.http.HttpParser getParser() -
getGenerator
public org.eclipse.jetty.http.HttpGenerator getGenerator() -
getMessagesIn
public long getMessagesIn()- Specified by:
getMessagesInin interfaceorg.eclipse.jetty.io.Connection- Overrides:
getMessagesInin classorg.eclipse.jetty.io.AbstractConnection
-
getMessagesOut
public long getMessagesOut()- Specified by:
getMessagesOutin interfaceorg.eclipse.jetty.io.Connection- Overrides:
getMessagesOutin classorg.eclipse.jetty.io.AbstractConnection
-
isUseInputDirectByteBuffers
public boolean isUseInputDirectByteBuffers() -
setUseInputDirectByteBuffers
public void setUseInputDirectByteBuffers(boolean useInputDirectByteBuffers) -
isUseOutputDirectByteBuffers
public boolean isUseOutputDirectByteBuffers() -
setUseOutputDirectByteBuffers
public void setUseOutputDirectByteBuffers(boolean useOutputDirectByteBuffers) -
onUpgradeFrom
- Specified by:
onUpgradeFromin interfaceorg.eclipse.jetty.io.Connection.UpgradeFrom
-
onUpgradeTo
- Specified by:
onUpgradeToin interfaceorg.eclipse.jetty.io.Connection.UpgradeTo
-
onFlushed
- Specified by:
onFlushedin interfaceorg.eclipse.jetty.io.WriteFlusher.Listener- Throws:
IOException
-
isRequestBufferEmpty
public boolean isRequestBufferEmpty() -
onFillable
public void onFillable()- Specified by:
onFillablein classorg.eclipse.jetty.io.AbstractConnection
-
onCompleted
public void onCompleted()Description copied from interface:HttpTransportCalled to indicated the end of the current request/response cycle (which may be some time after the last content is sent).- Specified by:
onCompletedin interfaceHttpTransport
-
onReadTimeout
- Overrides:
onReadTimeoutin classorg.eclipse.jetty.io.AbstractConnection
-
onFillInterestedFailed
- Overrides:
onFillInterestedFailedin classorg.eclipse.jetty.io.AbstractConnection
-
onOpen
public void onOpen()- Specified by:
onOpenin interfaceorg.eclipse.jetty.io.Connection- Overrides:
onOpenin classorg.eclipse.jetty.io.AbstractConnection
-
onClose
- Specified by:
onClosein interfaceorg.eclipse.jetty.io.Connection- Overrides:
onClosein classorg.eclipse.jetty.io.AbstractConnection
-
run
public void run() -
send
public void send(org.eclipse.jetty.http.MetaData.Request request, org.eclipse.jetty.http.MetaData.Response response, ByteBuffer content, boolean lastContent, org.eclipse.jetty.util.Callback callback) Description copied from interface:HttpTransportAsynchronous call to send a response (or part) over the transport- Specified by:
sendin interfaceHttpTransport- Parameters:
request- True if the response if for a HEAD request (and the data should not be sent).response- 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.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 on
-
abort
Description copied from interface:HttpTransportAborts this transport.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. If abort is called,
HttpTransport.onCompleted()is not called- Specified by:
abortin interfaceHttpTransport- Parameters:
failure- the failure that caused the abort.
-
isPushSupported
public boolean isPushSupported()- Specified by:
isPushSupportedin interfaceHttpTransport- Returns:
- true if responses can be pushed over this transport
-
push
public void push(org.eclipse.jetty.http.MetaData.Request request) - Specified by:
pushin interfaceHttpTransport- Parameters:
request- A request to use as the basis for generating a pushed response.
-
asyncReadFillInterested
public void asyncReadFillInterested() -
getBytesIn
public long getBytesIn()- Specified by:
getBytesInin interfaceorg.eclipse.jetty.io.Connection- Overrides:
getBytesInin classorg.eclipse.jetty.io.AbstractConnection
-
getBytesOut
public long getBytesOut()- Specified by:
getBytesOutin interfaceorg.eclipse.jetty.io.Connection- Overrides:
getBytesOutin classorg.eclipse.jetty.io.AbstractConnection
-
toConnectionString
- Overrides:
toConnectionStringin classorg.eclipse.jetty.io.AbstractConnection
-