Package org.eclipse.jetty.http2
Class HTTP2Stream
- java.lang.Object
-
- org.eclipse.jetty.io.IdleTimeout
-
- org.eclipse.jetty.http2.HTTP2Stream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,Stream
,IStream
,Attachable
,Callback
,Dumpable
,Invocable
public class HTTP2Stream extends IdleTimeout implements IStream, Callback, Dumpable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.Callback
Callback.Completable, Callback.Completing, Callback.Nested
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
Invocable.InvocationType
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.http2.IStream
IStream.FrameList
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.http2.api.Stream
Stream.Listener
-
-
Constructor Summary
Constructors Constructor Description HTTP2Stream(Scheduler scheduler, ISession session, int streamId, boolean local)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Forcibly closes this stream.void
commit()
Marks this stream as committed.void
data(DataFrame frame, Callback callback)
Sends the given DATAframe
.java.lang.String
dump()
void
dump(java.lang.Appendable out, java.lang.String indent)
Dump this object (and children) into an Appendable using the provided indent after any new lines.void
failed(java.lang.Throwable x)
Callback invoked when the operation fails.java.lang.Object
getAttachment()
java.lang.Object
getAttribute(java.lang.String key)
int
getId()
Invocable.InvocationType
getInvocationType()
Stream.Listener
getListener()
int
getRecvWindow()
int
getSendWindow()
ISession
getSession()
void
headers(HeadersFrame frame, Callback callback)
Sends the given HEADERSframe
.boolean
isClosed()
boolean
isCommitted()
boolean
isLocal()
boolean
isLocallyClosed()
boolean
isOpen()
This abstract method should be called to check if idle timeouts should still be checked.boolean
isRemotelyClosed()
boolean
isReset()
boolean
isResetOrFailed()
void
onClose()
protected void
onIdleExpired(java.util.concurrent.TimeoutException timeout)
This abstract method is called when the idle timeout has expired.void
process(Frame frame, Callback callback)
Processes the givenframe
, belonging to this stream.void
push(PushPromiseFrame frame, Promise<Stream> promise, Stream.Listener listener)
Sends the given PUSH_PROMISEframe
.java.lang.Object
removeAttribute(java.lang.String key)
void
reset(ResetFrame frame, Callback callback)
Sends the given RST_STREAMframe
.void
send(IStream.FrameList frameList, Callback callback)
Sends the given list of frames.void
setAttachment(java.lang.Object attachment)
Attaches the given object to this stream for later retrieval.void
setAttribute(java.lang.String key, java.lang.Object value)
void
setListener(Stream.Listener listener)
void
succeeded()
Callback invoked when the operation completes.java.lang.String
toString()
boolean
updateClose(boolean update, CloseState.Event event)
Updates the close state of this stream.int
updateRecvWindow(int delta)
Updates the stream receive window by the givendelta
.int
updateSendWindow(int delta)
Updates the stream send window by the givendelta
.-
Methods inherited from class org.eclipse.jetty.io.IdleTimeout
checkIdleTimeout, getIdleFor, getIdleTimeout, getScheduler, notIdle, onOpen, setIdleTimeout
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.jetty.http2.api.Stream
getIdleTimeout, setIdleTimeout
-
-
-
-
Method Detail
-
getAttachment
public java.lang.Object getAttachment()
- Specified by:
getAttachment
in interfaceAttachable
- Returns:
- the object attached to this instance
- See Also:
Attachable.setAttachment(Object)
-
setAttachment
public void setAttachment(java.lang.Object attachment)
Description copied from interface:Attachable
Attaches the given object to this stream for later retrieval.- Specified by:
setAttachment
in interfaceAttachable
- Parameters:
attachment
- the object to attach to this instance
-
isLocal
public boolean isLocal()
-
getSession
public ISession getSession()
- Specified by:
getSession
in interfaceIStream
- Specified by:
getSession
in interfaceStream
- Returns:
- the session this stream is associated to
-
send
public void send(IStream.FrameList frameList, Callback callback)
Description copied from interface:IStream
Sends the given list of frames.
Typically used to send HTTP headers along with content and possibly trailers.
-
headers
public void headers(HeadersFrame frame, Callback callback)
Description copied from interface:Stream
Sends the given HEADERS
frame
.Typically used to send an HTTP response or to send the HTTP response trailers.
-
push
public void push(PushPromiseFrame frame, Promise<Stream> promise, Stream.Listener listener)
Description copied from interface:Stream
Sends the given PUSH_PROMISE
frame
.
-
data
public void data(DataFrame frame, Callback callback)
Description copied from interface:Stream
Sends the given DATA
frame
.
-
reset
public void reset(ResetFrame frame, Callback callback)
Description copied from interface:Stream
Sends the given RST_STREAM
frame
.
-
getAttribute
public java.lang.Object getAttribute(java.lang.String key)
- Specified by:
getAttribute
in interfaceStream
- Parameters:
key
- the attribute key- Returns:
- an arbitrary object associated with the given key to this stream or null if no object can be found for the given key.
- See Also:
Stream.setAttribute(String, Object)
-
setAttribute
public void setAttribute(java.lang.String key, java.lang.Object value)
- Specified by:
setAttribute
in interfaceStream
- Parameters:
key
- the attribute keyvalue
- an arbitrary object to associate with the given key to this stream- See Also:
Stream.getAttribute(String)
,Stream.removeAttribute(String)
-
removeAttribute
public java.lang.Object removeAttribute(java.lang.String key)
- Specified by:
removeAttribute
in interfaceStream
- Parameters:
key
- the attribute key- Returns:
- the arbitrary object associated with the given key to this stream
- See Also:
Stream.setAttribute(String, Object)
-
isReset
public boolean isReset()
-
isResetOrFailed
public boolean isResetOrFailed()
- Specified by:
isResetOrFailed
in interfaceIStream
- Returns:
- whether this stream has been reset (locally or remotely) or has been failed
- See Also:
Stream.isReset()
,Stream.Listener.onFailure(Stream, int, String, Throwable, Callback)
-
isClosed
public boolean isClosed()
-
isRemotelyClosed
public boolean isRemotelyClosed()
- Specified by:
isRemotelyClosed
in interfaceIStream
- Returns:
- whether the stream is closed remotely.
- See Also:
Stream.isClosed()
-
isLocallyClosed
public boolean isLocallyClosed()
-
commit
public void commit()
Description copied from interface:IStream
Marks this stream as committed.- Specified by:
commit
in interfaceIStream
- See Also:
IStream.isCommitted()
-
isCommitted
public boolean isCommitted()
- Specified by:
isCommitted
in interfaceIStream
- Returns:
- whether bytes for this stream have been sent to the remote peer.
- See Also:
IStream.commit()
-
isOpen
public boolean isOpen()
Description copied from class:IdleTimeout
This abstract method should be called to check if idle timeouts should still be checked.- Specified by:
isOpen
in classIdleTimeout
- Returns:
- True if the entity monitored should still be checked for idle timeouts
-
onIdleExpired
protected void onIdleExpired(java.util.concurrent.TimeoutException timeout)
Description copied from class:IdleTimeout
This abstract method is called when the idle timeout has expired.- Specified by:
onIdleExpired
in classIdleTimeout
- Parameters:
timeout
- a TimeoutException
-
getListener
public Stream.Listener getListener()
- Specified by:
getListener
in interfaceIStream
- Returns:
- the
Stream.Listener
associated with this stream - See Also:
IStream.setListener(Stream.Listener)
-
setListener
public void setListener(Stream.Listener listener)
- Specified by:
setListener
in interfaceIStream
- Parameters:
listener
- theStream.Listener
associated with this stream- See Also:
IStream.getListener()
-
process
public void process(Frame frame, Callback callback)
Description copied from interface:IStream
Processes the given
frame
, belonging to this stream.
-
updateClose
public boolean updateClose(boolean update, CloseState.Event event)
Description copied from interface:IStream
Updates the close state of this stream.
- Specified by:
updateClose
in interfaceIStream
- Parameters:
update
- whether to update the close stateevent
- the event that caused the close state update- Returns:
- whether the stream has been fully closed by this invocation
-
getSendWindow
public int getSendWindow()
-
getRecvWindow
public int getRecvWindow()
-
updateSendWindow
public int updateSendWindow(int delta)
Description copied from interface:IStream
Updates the stream send window by the given
delta
.- Specified by:
updateSendWindow
in interfaceIStream
- Parameters:
delta
- the delta value (positive or negative) to add to the stream send window- Returns:
- the previous value of the stream send window
-
updateRecvWindow
public int updateRecvWindow(int delta)
Description copied from interface:IStream
Updates the stream receive window by the given
delta
.- Specified by:
updateRecvWindow
in interfaceIStream
- Parameters:
delta
- the delta value (positive or negative) to add to the stream receive window- Returns:
- the previous value of the stream receive window
-
close
public void close()
Description copied from interface:IStream
Forcibly closes this stream.
-
onClose
public void onClose()
- Overrides:
onClose
in classIdleTimeout
-
succeeded
public void succeeded()
Description copied from interface:Callback
Callback invoked when the operation completes.
- Specified by:
succeeded
in interfaceCallback
- See Also:
Callback.failed(Throwable)
-
failed
public void failed(java.lang.Throwable x)
Description copied from interface:Callback
Callback invoked when the operation fails.
-
getInvocationType
public Invocable.InvocationType getInvocationType()
- Specified by:
getInvocationType
in interfaceInvocable
- Returns:
- The InvocationType of this object
-
dump
public void dump(java.lang.Appendable out, java.lang.String indent) throws java.io.IOException
Description copied from interface:Dumpable
Dump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-