grafter.url

Utilities and protocols for building and handling URLs and URIs.

->GrafterURL

(->GrafterURL scheme host port path-segments query-params url-fragment)

Positional factory function for class grafter.url.GrafterURL.

->java-url

(->java-url url)

Convert a URI into a java.net.URL.

->url

(->url uri-str)

Parses a given string into a GrafterURL record. If the represented URI contains any reserved characters, they should be encoded correctly in the input string.

append-path-segments

(append-path-segments url & segments)

FIXME: write docs

IURIable

protocol

members

->java-uri

(->java-uri url)

Convert into a java.net.URI

IURL

protocol

A protocol for manipulating URL objects. Implementations of this protocol should also implement the protocols IURLable and IURIable

members

append-path-segments*

(append-path-segments* url segments)

Append new path segments to the URL path.

append-query-param

(append-query-param url key value)

Append the key and value to the query parameters

host

(host url)

Get the host domain of the URL.

path-segments

(path-segments url)

Get the path segments for the URL.

port

(port this)

Get the port of the URL.

query-params

(query-params url)

Return the query parameters for the URL as an ordered sequence of key/value tuples.

scheme

(scheme this)

Get the URL scheme.

set-host

(set-host url host)

Set the host domain of the URL.

set-path-segments*

(set-path-segments* url segments)

Set the path segments to those supplied.

set-port

(set-port this port)

Set the port of the URL.

set-query-params

(set-query-params url hash-map)

Adds the map of key value pairs to the query params. Sorts the keys first to help provide guarantee’s around URL equality.

set-scheme

(set-scheme url scheme)

Set the URL scheme e.g. http, https.

set-url-fragment

(set-url-fragment url fragment)

Set the URL #fragment

url-fragment

(url-fragment url)

Get the URL fragment from the URL.

map->GrafterURL

(map->GrafterURL m__5869__auto__)

Factory function for class grafter.url.GrafterURL, taking a map of keywords to field values.

parse-path

(parse-path path-str)

FIXME: write docs

query-params-map

(query-params-map url)

Returns a map of query parameters from a URL query string. If there are duplicate keys, the last occurrence of each duplicate parameter wins.

e.g. with the following query parameters ?foo=1&foo=2&bar=3 the map {“foo” 2 “bar” 3} is returned.

set-path-segments

(set-path-segments url & segments)

FIXME: write docs

ToGrafterURL

protocol

Convert any IURIable into a Grafter URL object.

members

->grafter-url

(->grafter-url uri-str)