Jamie Balfour

Welcome to my personal website.

Find out more about me, my personal projects, reviews, courses and much more here.

Official ZPE/YASS documentationURI

Object description

Represents a URI using RFC 3986 semantics by default. It can parse, inspect, transform, resolve, normalise, and serialise URI values, including their query parameters.

Availability: ZPE 1.14.11 is the first version to support the URI object.

Object functions

  • _construct

    Parses a URI string into a URI object.

  • _output

    Returns the URI as a string.

  • authority

    Returns the URI authority.

  • fragment

    Returns the URI fragment.

  • host

    Returns the URI host.

  • is_absolute

    Reports whether the URI is absolute.

  • is_opaque

    Reports whether the URI is opaque.

  • normalize

    Returns a normalized copy of the URI.

  • path

    Returns the URI path.

  • port

    Returns the URI port, or -1 when no port is present.

  • query

    Returns the URI query string.

  • query_parameters

    Returns the URI query parameters as a map. RFC 3986 decoding is used by default.

  • resolve

    Resolves a URI or relative path against this URI and returns the result as a new URI object.

  • rfc2396

    Returns an immutable copy using RFC 2396 form-style query decoding.

  • rfc3986

    Returns an immutable copy using RFC 3986 query decoding.

  • scheme

    Returns the URI scheme.

  • to_string

    Returns the URI as a string.

  • user_info

    Returns the URI user-information component.

  • with_fragment

    Returns an immutable copy with a different fragment.

  • with_host

    Returns an immutable copy with a different host.

  • with_path

    Returns an immutable copy with a different path.

  • with_port

    Returns an immutable copy with a different port.

  • with_query

    Returns an immutable copy with a different query string.

  • with_scheme

    Returns an immutable copy with a different scheme.

URI semantics

URI transformations are immutable: methods such as with_path(), resolve(), and normalize() return a new URI object and leave the original unchanged. Query parameters are decoded according to RFC 3986 by default, so a plus sign remains a literal plus sign.

Use rfc2396() for legacy form-style query decoding, or rfc3986() to explicitly return to the default RFC 3986 behaviour.

Comments

There are no comments on this page.

New comment

Comments are welcome and encouraged, including disagreement and critique. However, this is not a space for abuse. Disagreement is welcome; personal attacks, harassment, or hate will be removed instantly. This site reflects personal opinions, not universal truths. If you can’t distinguish between the two, this probably isn’t the place for you. The system temporarily stores IP addresses and browser user agents for the purposes of spam prevention, moderation, and safeguarding. This data is automatically removed after fourteen days. Your email address is stored so that replies can be sent to your email address.

Comments powered by BalfComment

Feedback 👍
Comments are sent via email to me.