Package ai.vespa.http

Class HttpURL

java.lang.Object
ai.vespa.http.HttpURL

public class HttpURL extends Object
This is the best class for creating, manipulating and inspecting HTTP URLs, because:
  • It is more restrictive than URI, but with a richer construction API, reducing risk of blunder.
    • Scheme must be HTTP or HTTPS.
    • Authority must be a DomainName, with an optional port.
    • HttpURL.Path must be normalized at all times.
    • Only HttpURL.Query is allowed, in addition to the above.
  • It contains all those helpful builder methods that URI has none of.
    • HttpURL.Path can be parsed, have segments or other paths appended, and cut.
    • HttpURL.Query can be parsed, and keys and key-value pairs can be inserted or removed.
    All these (except the parse methods) operate on decoded values.
  • It makes it super-easy to use a StringWrapper for validation of path and query segments.
Author:
jonmv