Class Path

java.lang.Object
kong.unirest.core.Path

public class Path extends Object
Class for building a URI with query params
  • Field Details

  • Constructor Details

    • Path

      public Path(String url)
      construct a path
      Parameters:
      url - the URL
    • Path

      Path(String url, String defaultBasePath)
      Construct a path with a URL that could be relative and a default base for it
      Parameters:
      url - the url
      defaultBasePath - the default base
  • Method Details

    • param

      public void param(Map<String,Object> params)
      replace path params designated with curley braces with a value
      Parameters:
      params - a map of param names and values
    • param

      public void param(String name, String value)
      replace a single path param by name
      Parameters:
      name - the name of the path param
      value - the value to replace it with
    • encodePath

      private String encodePath(String value)
    • queryString

      public void queryString(String name, Collection<?> value)
      Add a query param. This will result in a query param per value
      Parameters:
      name - the name
      value - a collection of values
    • queryString

      public void queryString(String name, Object value)
      Add a query param
      Parameters:
      name - the name
      value - the value
    • queryString

      public void queryString(Map<String,Object> parameters)
      Add query params as a map of key/values
      Parameters:
      parameters - the params to add
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • escape

      private String escape(String string)
    • rawPath

      public String rawPath()
      Returns:
      the full raw path
    • baseUrl

      public String baseUrl()
      Returns:
      the URL without the query string
    • getQueryString

      public String getQueryString()
      Returns:
      just the query string
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object