Class SafeHttpPolicy

java.lang.Object
com.kingsrook.qqq.backend.core.utils.http.SafeHttpPolicy

public final class SafeHttpPolicy extends Object
Limits for SafeHttpClient. Defaults: HTTPS only, no internal targets, connect 5 s, read 10 s, total 30 s, responses read up to 64 KiB, redirects never followed (a 3xx is returned as the response).
  • Constructor Details

    • SafeHttpPolicy

      public SafeHttpPolicy()
  • Method Details

    • defaults

      public static SafeHttpPolicy defaults()
      The defaults.
    • cacheKey

      public String cacheKey()
      A key that is equal for equal policies (used to share pooled clients).
    • withAllowPlainHttp

      public SafeHttpPolicy withAllowPlainHttp(boolean allowPlainHttp)
      Allow http:// (default false: https only).
    • withInternalAllowlist

      public SafeHttpPolicy withInternalAllowlist(List<String> internalAllowlist)
      Internal targets to allow (see AddressRules).
    • withConnectTimeout

      public SafeHttpPolicy withConnectTimeout(Duration connectTimeout)
      Connect timeout.
    • withReadTimeout

      public SafeHttpPolicy withReadTimeout(Duration readTimeout)
      Read (socket idle) timeout.
    • withTotalTimeout

      public SafeHttpPolicy withTotalTimeout(Duration totalTimeout)
      Whole-request timeout (connect, send and read together).
    • withMaxResponseBytes

      public SafeHttpPolicy withMaxResponseBytes(int maxResponseBytes)
      Most response body bytes read; the rest is discarded with the connection.
    • withUserAgent

      public SafeHttpPolicy withUserAgent(String userAgent)
      User-Agent header.
    • isAllowPlainHttp

      public boolean isAllowPlainHttp()
      Getter for allowPlainHttp.
    • getInternalAllowlist

      public List<String> getInternalAllowlist()
      Getter for internalAllowlist.
    • getConnectTimeout

      public Duration getConnectTimeout()
      Getter for connectTimeout.
    • getReadTimeout

      public Duration getReadTimeout()
      Getter for readTimeout.
    • getTotalTimeout

      public Duration getTotalTimeout()
      Getter for totalTimeout.
    • getMaxResponseBytes

      public int getMaxResponseBytes()
      Getter for maxResponseBytes.
    • getUserAgent

      public String getUserAgent()
      Getter for userAgent.