Class RequestOptions

java.lang.Object
org.attribyte.api.http.RequestOptions

public class RequestOptions extends Object
Request-specific options.
  • Field Details

    • DEFAULT_FOLLOW_REDIRECTS

      public static final boolean DEFAULT_FOLLOW_REDIRECTS
      The default follow redirects (true).
      See Also:
    • DEFAULT_MAX_RESPONSE_BYTES

      public static final int DEFAULT_MAX_RESPONSE_BYTES
      The maximum response size (10 MB).
      See Also:
    • DEFAULT_TIMEOUT_SECONDS

      public static final int DEFAULT_TIMEOUT_SECONDS
      The maximum time to wait for a response (5 seconds).
      See Also:
    • DEFAULT

      public static final RequestOptions DEFAULT
      The default request options.
    • followRedirects

      public final boolean followRedirects
      Are redirects followed?
    • maxResponseBytes

      public final int maxResponseBytes
      The maximum size of a response in bytes.
    • truncateOnLimit

      public final boolean truncateOnLimit
      Should the response be truncated if maxResponseBytes is reached (otherwise an exception is thrown)?
    • timeoutSeconds

      public final int timeoutSeconds
      The maximum time to wait for a response in seconds.
  • Constructor Details

    • RequestOptions

      public RequestOptions(boolean followRedirects, int maxResponseBytes, int timeoutSeconds)
      Creates request options.
      Parameters:
      followRedirects - Should redirects be followed?
      maxResponseBytes - The maximum allowed response size in bytes.
      timeoutSeconds - The maximum time to wait for a response in seconds.
    • RequestOptions

      public RequestOptions(boolean followRedirects, int maxResponseBytes, int timeoutSeconds, boolean truncateOnLimit)
      Creates request options.
      Parameters:
      followRedirects - Should redirects be followed?
      maxResponseBytes - The maximum allowed response size in bytes.
      timeoutSeconds - The maximum time to wait for a response in seconds.
      truncateOnLimit - Should the response be truncated if maxResponseBytes is reached (otherwise an exception is thrown)?
  • Method Details

    • truncateOnLimit

      public RequestOptions truncateOnLimit()
      Create request options that truncate the response if the limit is reached.
      Returns:
      The new request options.
    • followRedirects

      public RequestOptions followRedirects()
      Create request options that follows redirects.
      Returns:
      The new request options.
    • toString

      public String toString()
      Overrides:
      toString in class Object