Class HttpResponseHttpURLConnectionAdapter

  • All Implemented Interfaces:
    HttpResponse

    public class HttpResponseHttpURLConnectionAdapter
    extends java.lang.Object
    implements HttpResponse
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getHeader​(java.lang.String name)
      Gets the value of an HTTP response header.
      java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getHeaders()
      Gets the HTTP response headers and their values.
      java.lang.String getRequestMethod()
      Gets the request method associated with this response.
      java.net.URL getRequestUrl()
      Gets the request URL associated with this response.
      int getResponseCode()
      Gets the HTTP response code.
      java.lang.String getResponseMessage()
      Gets the HTTP response message.
      • Methods inherited from class java.lang.Object

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

      • HttpResponseHttpURLConnectionAdapter

        public HttpResponseHttpURLConnectionAdapter​(java.net.HttpURLConnection httpURLConnection)
    • Method Detail

      • getRequestUrl

        public java.net.URL getRequestUrl()
        Description copied from interface: HttpResponse
        Gets the request URL associated with this response.
        Specified by:
        getRequestUrl in interface HttpResponse
      • getRequestMethod

        public java.lang.String getRequestMethod()
        Description copied from interface: HttpResponse
        Gets the request method associated with this response.
        Specified by:
        getRequestMethod in interface HttpResponse
      • getResponseCode

        public int getResponseCode()
        Description copied from interface: HttpResponse
        Gets the HTTP response code.

        If reading the HTTP status line fails, Integer.MIN_VALUE is returned.

        Specified by:
        getResponseCode in interface HttpResponse
        Returns:
        HTTP response code returned by server, or a negative value in case of an error.
      • getResponseMessage

        public java.lang.String getResponseMessage()
        Description copied from interface: HttpResponse
        Gets the HTTP response message.

        If reading the HTTP status line fails, null is returned.

        Specified by:
        getResponseMessage in interface HttpResponse
        Returns:
        HTTP response message returned by server or null.
      • getHeaders

        public java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getHeaders()
        Description copied from interface: HttpResponse
        Gets the HTTP response headers and their values.
        Specified by:
        getHeaders in interface HttpResponse
        Returns:
        An immutable map of HTTP response headers mapping to their values.
      • getHeader

        public java.lang.String getHeader​(java.lang.String name)
        Description copied from interface: HttpResponse
        Gets the value of an HTTP response header.

        If the header occurs multiple times, it depends on the underlying implementation which value is returned. In this case prefer HttpResponse.getHeaders() instead.

        Specified by:
        getHeader in interface HttpResponse
        Returns:
        Value associated with HTTP response header name or null.