Class HttpContent
- java.lang.Object
-
- org.eclipse.jetty.client.HttpContent
-
@Deprecated(since="2021-05-27") public class HttpContent extends java.lang.Object implements Callback, java.io.Closeable
Deprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.HttpContent
is a stateful, linear representation of the request content provided by aContentProvider
that can be traversed one-way to obtain content buffers to send to an HTTP server.HttpContent
offers the notion of a one-way cursor to traverse the content. The cursor starts in a virtual "before" position and can be advanced usingadvance()
until it reaches a virtual "after" position where the content is fully consumed.+---+ +---+ +---+ +---+ +---+ | | | | | | | | | | +---+ +---+ +---+ +---+ +---+ ^ ^ ^ ^ | | --> advance() | | | | last | | | | before | after | current
At each valid (non-before and non-after) cursor position,HttpContent
provides the following state:- the buffer containing the content to send, via
getByteBuffer()
- a copy of the content buffer that can be used for notifications, via
getContent()
- whether the buffer to write is the last one, via
isLast()
HttpContent
may not have content, if the relatedContentProvider
isnull
, and this is reflected byhasContent()
.HttpContent
may havedeferred content
, in which caseadvance()
moves the cursor to a position that providesnull
buffer
andcontent
. When the deferred content is available, a further call toadvance()
will move the cursor to a position that provides nonnull
buffer and content. - the buffer containing the content to send, via
-
-
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.thread.Invocable
Invocable.InvocationType
-
-
Field Summary
-
Fields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking
-
-
Constructor Summary
Constructors Constructor Description HttpContent(ContentProvider provider)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
advance()
Deprecated.Advances the cursor to the next block of content.void
close()
Deprecated.void
failed(java.lang.Throwable x)
Deprecated.Callback invoked when the operation fails.java.nio.ByteBuffer
getByteBuffer()
Deprecated.java.nio.ByteBuffer
getContent()
Deprecated.boolean
hasContent()
Deprecated.boolean
isConsumed()
Deprecated.boolean
isLast()
Deprecated.void
succeeded()
Deprecated.Callback invoked when the operation completes.java.lang.String
toString()
Deprecated.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.jetty.util.thread.Invocable
getInvocationType
-
-
-
-
Constructor Detail
-
HttpContent
public HttpContent(ContentProvider provider)
Deprecated.
-
-
Method Detail
-
hasContent
public boolean hasContent()
Deprecated.- Returns:
- whether there is any content at all
-
isLast
public boolean isLast()
Deprecated.- Returns:
- whether the cursor points to the last content
-
getByteBuffer
public java.nio.ByteBuffer getByteBuffer()
Deprecated.- Returns:
- the
ByteBuffer
containing the content at the cursor's position
-
getContent
public java.nio.ByteBuffer getContent()
Deprecated.- Returns:
- a
ByteBuffer.slice()
ofgetByteBuffer()
at the cursor's position
-
advance
public boolean advance()
Deprecated.Advances the cursor to the next block of content.The next block of content may be valid (which yields a non-null buffer returned by
getByteBuffer()
), but may also be deferred (which yields a null buffer returned bygetByteBuffer()
).If the block of content pointed by the new cursor position is valid, this method returns true.
- Returns:
- true if there is content at the new cursor's position, false otherwise.
-
isConsumed
public boolean isConsumed()
Deprecated.- Returns:
- whether the cursor has been advanced past the
last
position.
-
succeeded
public void succeeded()
Deprecated.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)
Deprecated.Description copied from interface:Callback
Callback invoked when the operation fails.
-
close
public void close()
Deprecated.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
toString
public java.lang.String toString()
Deprecated.- Overrides:
toString
in classjava.lang.Object
-
-