Dispatch notifications

content_types_dispatch

Get available content types and their dispatch rules Example: {“text/html”, page} A special dispatch rule is ‘page_url’, which refers to the page_url property of the resource.

Type:
foldr
Return:
[{ContentType, DispatchRule}]
#content_types_dispatch{} properties:
  • id: m_rsc:resource()

dispatch_host

Try to find the site for the request Called when the request Host doesn’t match any active site.

Type:
first
Return:
{ok, #dispatch_redirect{}} or undefined
#dispatch_host{} properties:
  • host: binary
  • path: binary
  • method: binary
  • protocol: union

dispatch_match

Final try for dispatch, try to match the request. Called when the site is known, but no match is found for the path

Type:
first
Return:
{ok, RscId::integer()}, {ok, #dispatch_match{}}, {ok, #dispatch_redirect{}} or undefined
#dispatch_match{} properties:
  • dispatch_name: atom
  • mod: atom
  • mod_opts: list
  • path_tokens: list
  • bindings: list

dispatch_redirect

Final try for dispatch, try to match the request. Called when the site is known, but no match is found for the path

Type:
first
Return:
{ok, RscId::integer()}, {ok, #dispatch_match{}}, {ok, #dispatch_redirect{}} or undefined
#dispatch_redirect{} properties:
  • location: binary
  • is_permanent: boolean

dispatch_rewrite

Rewrite a URL before it will be dispatched using the z_sites_dispatcher

Type:
foldl

Return:

#dispatch_rewrite{} properties:
  • is_dir: boolean
  • path: string
  • host: unknown

page_url

Fetch the url of a resource’s html representation

Type:
first
Return:
{ok, Url} or undefined
#page_url{} properties:
  • id: unknown
  • is_a: unknown

url_abs

Make a generated URL absolute, optionally called after url_rewrite by z_dispatcher

Type:
first

Return:

#url_abs{} properties:
  • url: unknown
  • dispatch: unknown
  • dispatch_options: unknown

url_rewrite

Rewrite a URL after it has been generated using the z_dispatcher

Type:
foldl

Return:

#url_rewrite{} properties:
  • dispatch: atom
  • args: list