Class Request


  • public class Request
    extends java.lang.Object
    An object that holds request information used when executing a request.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Request.Builder  
    • Constructor Summary

      Constructors 
      Constructor Description
      Request​(java.lang.String httpMethod, java.lang.String url, java.util.Map<java.lang.String,​java.util.List<java.lang.String>> headers, byte[] dataToSend, Localization localization, boolean automaticLocalizationHeader)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] dataToSend()
      An optional byte array that will be sent when doing the request, very commonly used in POST requests.

      The implementation should make note of some recommended headers (for example, Content-Length in a post request).
      boolean equals​(java.lang.Object o)  
      static java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getHeadersFromLocalization​(Localization localization)  
      int hashCode()  
      java.util.Map<java.lang.String,​java.util.List<java.lang.String>> headers()
      A list of headers that will be used in the request.
      Any default headers that the implementation may have, should be overridden by these.
      java.lang.String httpMethod()
      A http method (i.e.
      Localization localization()
      A localization object that should be used when executing a request.

      Usually the Accept-Language will be set to this value (a helper method to do this easily: getHeadersFromLocalization(Localization)).
      static Request.Builder newBuilder()  
      java.lang.String url()
      The URL that is pointing to the wanted resource.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Request

        public Request​(java.lang.String httpMethod,
                       java.lang.String url,
                       @Nullable
                       java.util.Map<java.lang.String,​java.util.List<java.lang.String>> headers,
                       @Nullable
                       byte[] dataToSend,
                       @Nullable
                       Localization localization,
                       boolean automaticLocalizationHeader)
    • Method Detail

      • httpMethod

        public java.lang.String httpMethod()
        A http method (i.e. GET, POST, HEAD).
      • url

        public java.lang.String url()
        The URL that is pointing to the wanted resource.
      • headers

        public java.util.Map<java.lang.String,​java.util.List<java.lang.String>> headers()
        A list of headers that will be used in the request.
        Any default headers that the implementation may have, should be overridden by these.
      • dataToSend

        @Nullable
        public byte[] dataToSend()
        An optional byte array that will be sent when doing the request, very commonly used in POST requests.

        The implementation should make note of some recommended headers (for example, Content-Length in a post request).
      • localization

        @Nullable
        public Localization localization()
        A localization object that should be used when executing a request.

        Usually the Accept-Language will be set to this value (a helper method to do this easily: getHeadersFromLocalization(Localization)).
      • getHeadersFromLocalization

        @Nonnull
        public static java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getHeadersFromLocalization​(@Nullable
                                                                                                                        Localization localization)
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object