Class HttpConnection
- All Implemented Interfaces:
Closeable,AutoCloseable,Runnable,Connection,Connection.UpgradeFrom,Connection.UpgradeTo,ConnectionMetaData,Attributes,Invocable
A Connection that handles the HTTP protocol.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classprotected classNested classes/interfaces inherited from interface org.eclipse.jetty.util.Attributes
Attributes.Layer, Attributes.Lazy, Attributes.Mapped, Attributes.SyntheticNested classes/interfaces inherited from interface org.eclipse.jetty.io.Connection
Connection.Listener, Connection.UpgradeFrom, Connection.UpgradeToNested classes/interfaces inherited from interface org.eclipse.jetty.server.ConnectionMetaData
ConnectionMetaData.WrapperNested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
Invocable.Callable, Invocable.InvocationType, Invocable.ReadyTask, Invocable.Task -
Field Summary
Fields inherited from interface org.eclipse.jetty.util.Attributes
NULLFields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking, NOOP -
Constructor Summary
ConstructorsConstructorDescriptionHttpConnection(HttpConfiguration configuration, Connector connector, EndPoint endPoint) HttpConnection(HttpConfiguration configuration, Connector connector, EndPoint endPoint, boolean recordComplianceViolations) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidClear all attribute namesvoidclose()Performs a logical close of this connection.getAttribute(String name) Get an attributeGet the immutable set of attribute names.longlongstatic HttpConnectionGet the current connection that this thread is dispatched to.getId()longlongbooleanbooleanDeprecated, for removal: This API element is subject to removal in a future version.No replacement, no longer used withinHttpConnection, will be removed in Jetty 12.1.0booleanbooleanbooleanprotected HttpChannelnewHttpChannel(Server server, HttpConfiguration configuration) protected HttpGeneratorprotected HttpParsernewHttpParser(HttpCompliance compliance) protected HttpConnection.HttpStreamOverHTTP1newHttpStream(String method, String uri, HttpVersion version) protected HttpConnection.RequestHandlervoidCallback method invoked when the endpoint is ready to be read.protected voidonFillInterestedFailed(Throwable cause) Callback method invoked when the endpoint failed to be ready to be read.booleanonIdleExpired(TimeoutException timeout) Callback method invoked upon an idle timeout event.voidonOpen()Callback method invoked when this connection is opened.Invoked during anupgradeto produce a buffer containing bytes that have not been consumed by this connection, and that must be consumed by the upgrade-to connection.voidonUpgradeTo(ByteBuffer buffer) Invoked during anupgradeto receive a buffer containing bytes that have not been consumed by the upgrade-from connection, and that must be consumed by this connection.removeAttribute(String name) Remove an attributevoidrun()setAttribute(String name, Object attribute) Set an attributeprotected static HttpConnectionsetCurrentConnection(HttpConnection connection) voidsetUseInputDirectByteBuffers(boolean useInputDirectByteBuffers) voidsetUseOutputDirectByteBuffers(boolean useOutputDirectByteBuffers) Methods inherited from class org.eclipse.jetty.server.AbstractMetaDataConnection
getConnection, getConnector, getHttpConfiguration, getLocalSocketAddress, getRemoteSocketAddressMethods inherited from class org.eclipse.jetty.io.AbstractConnection
addEventListener, failedCallback, fillInterested, getCreatedTimeStamp, getEndPoint, getExecutor, getInputBufferSize, isFillInterested, onClose, onReadTimeout, removeEventListener, setInputBufferSize, toString, tryFillInterestedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.Attributes
asAttributeMap, equals, hashCodeMethods inherited from interface org.eclipse.jetty.server.ConnectionMetaData
getConnection, getConnector, getHttpConfiguration, getLocalSocketAddress, getRemoteSocketAddress, getServerAuthority, isPushSupported, isSecure
-
Constructor Details
-
HttpConnection
@Deprecated(since="12.0.6", forRemoval=true) public HttpConnection(HttpConfiguration configuration, Connector connector, EndPoint endPoint, boolean recordComplianceViolations) Deprecated, for removal: This API element is subject to removal in a future version.useHttpConnection(HttpConfiguration, Connector, EndPoint)instead. Will be removed in Jetty 12.1.0 -
HttpConnection
-
-
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
-
getInvocationType
- Specified by:
getInvocationTypein interfaceInvocable- Overrides:
getInvocationTypein classAbstractConnection- Returns:
- The InvocationType of this object
-
isRecordHttpComplianceViolations
Deprecated, for removal: This API element is subject to removal in a future version.No replacement, no longer used withinHttpConnection, will be removed in Jetty 12.1.0 -
newHttpGenerator
-
newHttpParser
-
newHttpChannel
-
newHttpStream
protected HttpConnection.HttpStreamOverHTTP1 newHttpStream(String method, String uri, HttpVersion version) -
newRequestHandler
-
getServer
-
getHttpChannel
-
getParser
-
getGenerator
-
getId
- Specified by:
getIdin interfaceConnectionMetaData- Returns:
- a unique (within the lifetime of the JVM) identifier string for the network connection to the JVM
-
getHttpVersion
- Specified by:
getHttpVersionin interfaceConnectionMetaData
-
getProtocol
- Specified by:
getProtocolin interfaceConnectionMetaData
-
isPersistent
public boolean isPersistent()- Specified by:
isPersistentin interfaceConnectionMetaData
-
removeAttribute
Description copied from interface:AttributesRemove an attribute- Specified by:
removeAttributein interfaceAttributes- Parameters:
name- the attribute to remove- Returns:
- the value of the attribute if removed, else
null
-
setAttribute
Description copied from interface:AttributesSet an attribute- Specified by:
setAttributein interfaceAttributes- Parameters:
name- the attribute to setattribute- the value to set. A null value is equivalent to removing the attribute.- Returns:
- the previous value of the attribute if set, else
null
-
getAttribute
Description copied from interface:AttributesGet an attribute- Specified by:
getAttributein interfaceAttributes- Parameters:
name- the attribute to get- Returns:
- the value of the attribute, or
nullif no such attribute exists
-
getAttributeNameSet
Description copied from interface:AttributesGet the immutable set of attribute names.- Specified by:
getAttributeNameSetin interfaceAttributes- Returns:
- Set of attribute names, or an empty set if there are no attributes.
-
clearAttributes
public void clearAttributes()Description copied from interface:AttributesClear all attribute names- Specified by:
clearAttributesin interfaceAttributes
-
getMessagesIn
public long getMessagesIn()- Specified by:
getMessagesInin interfaceConnection- Overrides:
getMessagesInin classAbstractConnection
-
getMessagesOut
public long getMessagesOut()- Specified by:
getMessagesOutin interfaceConnection- Overrides:
getMessagesOutin classAbstractConnection
-
isUseInputDirectByteBuffers
public boolean isUseInputDirectByteBuffers() -
setUseInputDirectByteBuffers
public void setUseInputDirectByteBuffers(boolean useInputDirectByteBuffers) -
isUseOutputDirectByteBuffers
public boolean isUseOutputDirectByteBuffers() -
setUseOutputDirectByteBuffers
public void setUseOutputDirectByteBuffers(boolean useOutputDirectByteBuffers) -
onUpgradeFrom
Description copied from interface:Connection.UpgradeFromInvoked during an
upgradeto produce a buffer containing bytes that have not been consumed by this connection, and that must be consumed by the upgrade-to connection.- Specified by:
onUpgradeFromin interfaceConnection.UpgradeFrom- Returns:
- a buffer of unconsumed bytes to pass to the upgrade-to connection. The buffer does not belong to any pool and should be discarded after having consumed its bytes. The returned buffer may be null if there are no unconsumed bytes.
-
onUpgradeTo
Description copied from interface:Connection.UpgradeToInvoked during an
upgradeto receive a buffer containing bytes that have not been consumed by the upgrade-from connection, and that must be consumed by this connection.- Specified by:
onUpgradeToin interfaceConnection.UpgradeTo- Parameters:
buffer- a non-null buffer of unconsumed bytes received from the upgrade-from connection. The buffer does not belong to any pool and should be discarded after having consumed its bytes.
-
isRequestBufferEmpty
public boolean isRequestBufferEmpty() -
onFillable
public void onFillable()Description copied from class:AbstractConnectionCallback method invoked when the endpoint is ready to be read.
- Specified by:
onFillablein classAbstractConnection- See Also:
-
onFillInterestedFailed
Description copied from class:AbstractConnectionCallback method invoked when the endpoint failed to be ready to be read.
- Overrides:
onFillInterestedFailedin classAbstractConnection- Parameters:
cause- the exception that caused the failure
-
onIdleExpired
Description copied from interface:ConnectionCallback method invoked upon an idle timeout event.
Implementations of this method may return true to indicate that the idle timeout handling should proceed normally, typically failing the EndPoint and causing it to be closed.
When false is returned, the handling of the idle timeout event is halted immediately and the EndPoint left in the state it was before the idle timeout event.
- Specified by:
onIdleExpiredin interfaceConnection- Overrides:
onIdleExpiredin classAbstractConnection- Returns:
- true to let the EndPoint handle the idle timeout, false to tell the EndPoint to halt the handling of the idle timeout.
-
close
public void close()Description copied from interface:ConnectionPerforms a logical close of this connection.
For simple connections, this may just mean to delegate the close to the associated
EndPointbut, for example, SSL connections should write the SSL close message before closing the associatedEndPoint.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceConnection- Overrides:
closein classAbstractConnection
-
onOpen
public void onOpen()Description copied from interface:ConnectionCallback method invoked when this connection is opened.
Creators of the connection implementation are responsible for calling this method.
- Specified by:
onOpenin interfaceConnection- Overrides:
onOpenin classAbstractConnection
-
run
-
asyncReadFillInterested
public void asyncReadFillInterested() -
getBytesIn
public long getBytesIn()- Specified by:
getBytesInin interfaceConnection- Overrides:
getBytesInin classAbstractConnection
-
getBytesOut
public long getBytesOut()- Specified by:
getBytesOutin interfaceConnection- Overrides:
getBytesOutin classAbstractConnection
-
toConnectionString
- Overrides:
toConnectionStringin classAbstractConnection
-
HttpConnection(HttpConfiguration, Connector, EndPoint)instead.