Interface IHttpRequest

All Known Subinterfaces:
IHttpStreamRequest
All Known Implementing Classes:
BaseActionCollectionRequest, BaseCollectionRequest, BaseCollectionWithReferencesRequest, BaseDeltaCollectionRequest, BaseEntityCollectionRequest, BaseFunctionCollectionRequest, BaseReferenceRequest, BaseRequest, BaseStreamRequest, BaseVoidActionCollectionRequest, BaseWithReferenceRequest, BatchRequest, CustomRequest, PrimitiveRequest

public interface IHttpRequest
An HTTP request
  • Method Details

    • getRequestUrl

      @Nullable URL getRequestUrl()
      Gets the request URL
      Returns:
      the request URL
    • getHttpMethod

      @Nullable HttpMethod getHttpMethod()
      Gets the HTTP method
      Returns:
      the HTTP method
    • getHeaders

      @Nullable List<HeaderOption> getHeaders()
      Gets the headers
      Returns:
      the headers
    • getOptions

      @Nullable List<Option> getOptions()
      Gets the options
      Returns:
      the options
    • addHeader

      void addHeader(@Nonnull String header, @Nonnull String value)
      Adds a header to this request
      Parameters:
      header - the name of the header
      value - the value of the header
    • setUseCaches

      void setUseCaches(boolean useCaches)
      Sets useCaches parameter to cache the response
      Parameters:
      useCaches - the value of useCaches
    • getUseCaches

      boolean getUseCaches()
      Gets useCaches parameter
      Returns:
      the value of useCaches
    • setMaxRedirects

      void setMaxRedirects(int maxRedirects)
      Sets the max redirects
      Parameters:
      maxRedirects - Max redirects that a request can take
    • getMaxRedirects

      int getMaxRedirects()
      Gets the max redirects
      Returns:
      Max redirects that a request can take
    • setShouldRedirect

      void setShouldRedirect(@Nonnull IShouldRedirect shouldRedirect)
      Sets the should redirect callback
      Parameters:
      shouldRedirect - Callback called before doing a redirect
    • getShouldRedirect

      @Nonnull IShouldRedirect getShouldRedirect()
      Gets the should redirect callback
      Returns:
      Callback which is called before redirect
    • setShouldRetry

      void setShouldRetry(@Nonnull IShouldRetry shouldretry)
      Sets the should retry callback
      Parameters:
      shouldretry - The callback called before retry
    • getShouldRetry

      @Nonnull IShouldRetry getShouldRetry()
      Gets the should retry callback
      Returns:
      Callback called before retry
    • setMaxRetries

      void setMaxRetries(int maxRetries)
      Sets the max retries
      Parameters:
      maxRetries - Max retries for a request
    • getMaxRetries

      int getMaxRetries()
      Gets max retries
      Returns:
      Max retries for a request
    • setDelay

      void setDelay(long delay)
      Sets the delay in seconds between retires
      Parameters:
      delay - Delay in seconds between retries
    • getDelay

      long getDelay()
      Gets delay between retries
      Returns:
      Delay between retries in seconds
    • withHttpMethod

      @Nullable IHttpRequest withHttpMethod(@Nonnull HttpMethod httpMethod)
      Sets the HTTP method and returns the current request
      Parameters:
      httpMethod - the HTTP method
      Returns:
      the current request
    • getHttpRequest

      @Nullable default <nativeRequestType> nativeRequestType getHttpRequest() throws ClientException
      Returns the Request object to be executed
      Type Parameters:
      nativeRequestType - type of a request for the native http client
      Returns:
      the Request object to be executed
      Throws:
      ClientException
    • getHttpRequest

      @Nullable <requestBodyType,​ responseType,​ nativeRequestType> nativeRequestType getHttpRequest(@Nullable requestBodyType serializedObject) throws ClientException
      Returns the Request object to be executed
      Type Parameters:
      requestBodyType - the type of the serialized object
      responseType - the type of the response
      nativeRequestType - type of a request for the native http client
      Parameters:
      serializedObject - the object to serialize at the body of the request
      Returns:
      the Request object to be executed
      Throws:
      ClientException