Class HttpUrl


  • public class HttpUrl
    extends Object
    Compatibility layer for OkHttp.
    • Constructor Detail

      • HttpUrl

        public HttpUrl​(URI uri)
    • Method Detail

      • encodedPath

        public final String encodedPath()
        Returns the entire path of this URL encoded for use in HTTP resource resolution. The returned path will start with "/".

        Examples
        URL encodedPath()
        http://host/ "/"
        http://host/a/b/c "/a/b/c"
        http://host/a/b%20c/d "/a/b%20c/d"
      • queryParameter

        public final String queryParameter​(String name)
        Returns the first query parameter named name decoded using UTF-8, or null if there is no such query parameter.

        Examples
        URL queryParameter("a")
        http://host/ null
        http://host/? null
        http://host/?a=apple&k=key+lime "apple"
        http://host/?a=apple&a=apricot "apple"
        http://host/?a=apple&b "apple"
      • toString

        public final String toString()
        Returns the content of this HttpUrl as a String.
        Overrides:
        toString in class Object
        Returns:
        the content of this HttpUrl as a String.
      • fromUrl

        public static HttpUrl fromUrl​(URL url)