Class HttpPath


public class HttpPath extends Object
Specifies the path for an HTTP request.

May also include the query string, if desired.

Create new instances using the static factory method.

See Also:
  • Method Details

    • of

      public static HttpPath of(String template, String... args)
      Returns a new path, substituting any "{}" placeholders in the template with the corresponding argument.

      Placeholder values are automatically URL-encoded.

      Example usage:

       HttpPath path = HttpPath.of("/foo/{}/bar/{}", "hello world", "xyzzy");
      template - The template string, which may include "{}" placeholders.
      args - un-encoded values to substitute for the placeholders. Values are automatically URL-encoded during the substitution process.
      IllegalArgumentException - if the number of placeholders does not match the number of arguments.
      See Also:
    • of

      public static HttpPath of(String template, List<String> args)
      Like of(String, String...) but takes the arguments as a list instead of varargs.
      See Also:
    • toString

      public String toString()
      toString in class Object