Class PathRequestContent

java.lang.Object
org.eclipse.jetty.client.util.AbstractRequestContent
org.eclipse.jetty.client.util.PathRequestContent
All Implemented Interfaces:
Request.Content

public class PathRequestContent extends AbstractRequestContent

A Request.Content for files using JDK 7's java.nio.file APIs.

It is possible to specify, at the constructor, a buffer size used to read content from the stream, by default 4096 bytes. If a ByteBufferPool is provided via setByteBufferPool(ByteBufferPool), the buffer will be allocated from that pool, otherwise one buffer will be allocated and used to read the file.

  • Constructor Details

  • Method Details

    • getLength

      public long getLength()
      Returns:
      the content length, if known, or -1 if the content length is unknown
    • isReproducible

      public boolean isReproducible()
      Description copied from interface: Request.Content

      Whether this content producer can produce exactly the same content more than once.

      Implementations should return true only if the content can be produced more than once, which means that Request.Content.subscribe(Consumer, boolean) may be called again.

      The HttpClient implementation may use this method in particular cases where it detects that it is safe to retry a request that failed.

      Returns:
      whether the content can be produced more than once
    • getByteBufferPool

      public ByteBufferPool getByteBufferPool()
    • setByteBufferPool

      public void setByteBufferPool(ByteBufferPool byteBufferPool)
    • isUseDirectByteBuffers

      public boolean isUseDirectByteBuffers()
    • setUseDirectByteBuffers

      public void setUseDirectByteBuffers(boolean useDirectByteBuffers)
    • newSubscription

      protected Request.Content.Subscription newSubscription(Request.Content.Consumer consumer, boolean emitInitialContent)
      Specified by:
      newSubscription in class AbstractRequestContent