Class Response


  • public class Response
    extends java.lang.Object
    A Data class used to hold the results from requests made by the Downloader implementation.
    • Constructor Summary

      Constructors 
      Constructor Description
      Response​(int responseCode, java.lang.String responseMessage, java.util.Map<java.lang.String,​java.util.List<java.lang.String>> responseHeaders, java.lang.String responseBody, java.lang.String latestUrl)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getHeader​(java.lang.String name)
      For easy access to some header value that (usually) don't repeat itself.
      java.lang.String latestUrl()
      Used for detecting a possible redirection, limited to the latest one.
      java.lang.String responseBody()  
      int responseCode()  
      java.util.Map<java.lang.String,​java.util.List<java.lang.String>> responseHeaders()  
      java.lang.String responseMessage()  
      • Methods inherited from class java.lang.Object

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

      • Response

        public Response​(int responseCode,
                        java.lang.String responseMessage,
                        @Nullable
                        java.util.Map<java.lang.String,​java.util.List<java.lang.String>> responseHeaders,
                        @Nullable
                        java.lang.String responseBody,
                        @Nullable
                        java.lang.String latestUrl)
    • Method Detail

      • responseCode

        public int responseCode()
      • responseMessage

        public java.lang.String responseMessage()
      • responseHeaders

        public java.util.Map<java.lang.String,​java.util.List<java.lang.String>> responseHeaders()
      • responseBody

        @Nonnull
        public java.lang.String responseBody()
      • latestUrl

        @Nonnull
        public java.lang.String latestUrl()
        Used for detecting a possible redirection, limited to the latest one.
        Returns:
        latest url known right before this response object was created
      • getHeader

        @Nullable
        public java.lang.String getHeader​(java.lang.String name)
        For easy access to some header value that (usually) don't repeat itself.

        For getting all the values associated to the header, use responseHeaders() (e.g. Set-Cookie).

        Parameters:
        name - the name of the header
        Returns:
        the first value assigned to this header