Class HttpConnectionOverHTTP
- All Implemented Interfaces:
Closeable,AutoCloseable,Connection,IConnection,Connection,Connection.UpgradeFrom,Attachable,Sweeper.Sweepable
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.Connection
Connection.Listener, Connection.UpgradeFrom, Connection.UpgradeTo -
Constructor Summary
ConstructorsConstructorDescriptionHttpConnectionOverHTTP(EndPoint endPoint, Map<String, Object> context) HttpConnectionOverHTTP(EndPoint endPoint, HttpDestination destination, Promise<Connection> promise) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanprotected voidaddBytesIn(long bytesIn) protected voidaddBytesOut(long bytesOut) voidclose()Performs a logical close of this connection.protected voidlonglonglonglongbooleanisClosed()protected HttpChannelOverHTTPvoidCallback method invoked when the endpoint is ready to be read.booleanCallback method invoked upon an idle timeout event.protected booleanonIdleTimeout(long idleTimeout) 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.voidrelease()voidremove()voidsend(Request request, Response.CompleteListener listener) Sends a request with an associated response listener.send(HttpExchange exchange) voidsetAttachment(Object obj) Attaches the given object to this stream for later retrieval.booleansweep()Methods inherited from class org.eclipse.jetty.io.AbstractConnection
addEventListener, failedCallback, fillInterested, getCreatedTimeStamp, getEndPoint, getExecutor, getInputBufferSize, isFillInterested, onClose, onFillInterestedFailed, onReadTimeout, removeEventListener, setInputBufferSize, toString, tryFillInterested
-
Constructor Details
-
HttpConnectionOverHTTP
-
HttpConnectionOverHTTP
public HttpConnectionOverHTTP(EndPoint endPoint, HttpDestination destination, Promise<Connection> promise)
-
-
Method Details
-
newHttpChannel
-
getHttpChannel
-
getHttpDestination
-
getLocalSocketAddress
- Specified by:
getLocalSocketAddressin interfaceConnection- Returns:
- the local socket address associated with the connection
-
getRemoteSocketAddress
- Specified by:
getRemoteSocketAddressin interfaceConnection- Returns:
- the remote socket address associated with the connection
-
getBytesIn
public long getBytesIn()- Specified by:
getBytesInin interfaceConnection- Overrides:
getBytesInin classAbstractConnection
-
addBytesIn
protected void addBytesIn(long bytesIn) -
getBytesOut
public long getBytesOut()- Specified by:
getBytesOutin interfaceConnection- Overrides:
getBytesOutin classAbstractConnection
-
addBytesOut
protected void addBytesOut(long bytesOut) -
getMessagesIn
public long getMessagesIn()- Specified by:
getMessagesInin interfaceConnection- Overrides:
getMessagesInin classAbstractConnection
-
getMessagesOut
public long getMessagesOut()- Specified by:
getMessagesOutin interfaceConnection- Overrides:
getMessagesOutin classAbstractConnection
-
send
Description copied from interface:ConnectionSends a request with an associated response listener.Request.send(Response.CompleteListener)will eventually call this method to send the request. It is exposed to allow applications to send requests via unpooled connections.- Specified by:
sendin interfaceConnection- Parameters:
request- the request to sendlistener- the response listener
-
send
- Specified by:
sendin interfaceIConnection
-
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
-
isClosed
public boolean isClosed()- Specified by:
isClosedin interfaceConnection- Returns:
- whether this connection has been closed
- See Also:
-
setAttachment
Description copied from interface:AttachableAttaches the given object to this stream for later retrieval.- Specified by:
setAttachmentin interfaceAttachable- Parameters:
obj- the object to attach to this instance
-
getAttachment
- Specified by:
getAttachmentin interfaceAttachable- Returns:
- the object attached to this instance
- See Also:
-
onIdleExpired
public boolean 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.
-
onIdleTimeout
protected boolean onIdleTimeout(long idleTimeout) -
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:
-
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.
-
release
public void release() -
remove
public void remove() -
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- Specified by:
closein interfaceConnection- Overrides:
closein classAbstractConnection
-
close
-
abort
-
sweep
public boolean sweep()- Specified by:
sweepin interfaceSweeper.Sweepable- Returns:
- whether this resource should be swept
-
toConnectionString
- Overrides:
toConnectionStringin classAbstractConnection
-