Class HttpClient.Response

    • Constructor Detail

    • Method Detail

      • debugRedirect

        protected final void debugRedirect()
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • uncompress

        public final HttpClient.Response uncompress​(boolean uncompress)
        Sets whether getContent() should uncompress the input stream if necessary.
        Parameters:
        uncompress - whether the input stream should be uncompressed if necessary
        Returns:
        this
      • uncompressAccordingToContentDisposition

        public final HttpClient.Response uncompressAccordingToContentDisposition​(boolean uncompressAccordingToContentDisposition)
        Sets whether getContent() should uncompress the input stream according to Content-Disposition HTTP header.
        Parameters:
        uncompressAccordingToContentDisposition - whether the input stream should be uncompressed according to Content-Disposition
        Returns:
        this
        Since:
        9172
      • getURL

        public abstract java.net.URL getURL()
        Returns the URL.
        Returns:
        the URL
        Since:
        9172
        See Also:
        URLConnection.getURL()
      • getRequestMethod

        public abstract java.lang.String getRequestMethod()
        Returns the request method.
        Returns:
        the HTTP request method
        Since:
        9172
        See Also:
        HttpURLConnection.getRequestMethod()
      • getContent

        public final java.io.InputStream getContent()
                                             throws java.io.IOException
        Returns an input stream that reads from this HTTP connection, or, error stream if the connection failed but the server sent useful data.

        Note: the return value can be null, if both the input and the error stream are null. Seems to be the case if the OSM server replies a 401 Unauthorized, see #3887

        Returns:
        input or error stream
        Throws:
        java.io.IOException - if any I/O error occurs
        See Also:
        URLConnection.getInputStream(), HttpURLConnection.getErrorStream()
      • getInputStream

        protected abstract java.io.InputStream getInputStream()
                                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • getContentReader

        public final java.io.BufferedReader getContentReader()
                                                      throws java.io.IOException
        Returns getContent() wrapped in a buffered reader. Detects Unicode charset in use utilizing UTFInputStreamReader.
        Returns:
        buffered reader
        Throws:
        java.io.IOException - if any I/O error occurs
      • fetchContent

        public final java.lang.String fetchContent()
                                            throws java.io.IOException
        Fetches the HTTP response as String.
        Returns:
        the response
        Throws:
        java.io.IOException - if any I/O error occurs
      • getResponseCode

        public final int getResponseCode()
        Gets the response code from this HTTP connection.
        Returns:
        HTTP response code
        See Also:
        HttpURLConnection.getResponseCode()
      • getResponseMessage

        public final java.lang.String getResponseMessage()
        Gets the response message from this HTTP connection.
        Returns:
        HTTP response message
        Since:
        9172
        See Also:
        HttpURLConnection.getResponseMessage()
      • getContentEncoding

        public abstract java.lang.String getContentEncoding()
        Returns the Content-Encoding header.
        Returns:
        Content-Encoding HTTP header
        See Also:
        URLConnection.getContentEncoding()
      • getContentType

        public abstract java.lang.String getContentType()
        Returns the Content-Type header.
        Returns:
        Content-Type HTTP header
        See Also:
        URLConnection.getContentType()
      • getExpiration

        public abstract long getExpiration()
        Returns the Expire header.
        Returns:
        Expire HTTP header
        Since:
        9232
        See Also:
        URLConnection.getExpiration()
      • getLastModified

        public abstract long getLastModified()
        Returns the Last-Modified header.
        Returns:
        Last-Modified HTTP header
        Since:
        9232
        See Also:
        URLConnection.getLastModified()
      • getContentLength

        public abstract long getContentLength()
        Returns the Content-Length header.
        Returns:
        Content-Length HTTP header
        See Also:
        URLConnection.getContentLengthLong()
      • getHeaderField

        public abstract java.lang.String getHeaderField​(java.lang.String name)
        Returns the value of the named header field.
        Parameters:
        name - the name of a header field
        Returns:
        the value of the named header field, or null if there is no such field in the header
        Since:
        9172
        See Also:
        URLConnection.getHeaderField(String)
      • getHeaderFields

        public abstract java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getHeaderFields()
        Returns an unmodifiable Map mapping header keys to a List of header values. As per RFC 2616, section 4.2 header names are case insensitive, so returned map is also case insensitive
        Returns:
        unmodifiable Map mapping header keys to a List of header values
        Since:
        9232
        See Also:
        URLConnection.getHeaderFields()
      • disconnect

        public abstract void disconnect()
        Indicates that other requests to the server are unlikely in the near future.
        See Also:
        HttpURLConnection.disconnect()