Module z_dispatcher

Manage dispatch lists (aka definitions for url patterns).

Copyright 2009-2012 Marc Worrell

Behaviours: gen_server.

Authors: Marc Worrell (marc@worrell.nl).

Description

Manage dispatch lists (aka definitions for url patterns). Constructs named urls from dispatch lists.

Function Index

abs_url/2Make the url an absolute url.
code_change/3Convert process state when code is changed.
dispatcher_args/0A list of dispatch rule arguments that shouldn't be considered with redirects.
dispatchinfo/1Fetch the dispatchlist for the site.
drop_port/1Drop the portnumber from the hostname.
handle_call/3Create the url for the dispatch rule with name and arguments Args.
handle_cast/2
handle_info/2Handling all non call/cast messages.
hostname/1Fetch the preferred hostname for this site.
hostname_port/1Fetch the preferred hostname, including port, for this site.
init/1Initiates the server, loads the dispatch list into the webmachine dispatcher.
reload/1Reload all dispatch lists.
reload/2
start_link/1Starts the dispatch server.
terminate/2This function is called by a gen_server when it is about to terminate.
update/1Update the dispatch list but don't reload it yet.
url_for/2Construct an uri from a named dispatch, assuming no parameters.
url_for/3Construct an uri from a named dispatch and the parameters.
url_for/4Construct an uri from a named dispatch and the parameters.

Function Details

abs_url/2

abs_url(Url, Context) -> any()

Make the url an absolute url

code_change/3

code_change(OldVsn, State, Extra) -> {ok, NewState}

Convert process state when code is changed

dispatcher_args/0

dispatcher_args() -> any()

A list of dispatch rule arguments that shouldn't be considered with redirects. Used by controller_file_id and controller_redirect

dispatchinfo/1

dispatchinfo(Context) -> {host, hostname, streamhost, smtphost, hostaliases, redirect, dispatchlist}

Fetch the dispatchlist for the site.

drop_port/1

drop_port(Hostname) -> any()

Drop the portnumber from the hostname

handle_call/3

handle_call(X1::Request, From, State) -> {reply, Reply, State} | {reply, Reply, State, Timeout} | {noreply, State} | {noreply, State, Timeout} | {stop, Reason, Reply, State} | {stop, Reason, State}

Create the url for the dispatch rule with name and arguments Args.

handle_cast/2

handle_cast(Msg, State) -> {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}

handle_info/2

handle_info(Info, State) -> {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}

Handling all non call/cast messages

hostname/1

hostname(Context) -> iolist()

Fetch the preferred hostname for this site

hostname_port/1

hostname_port(Context) -> iolist()

Fetch the preferred hostname, including port, for this site

init/1

init(SiteProps::Args) -> {ok, State} | {ok, State, Timeout} | ignore | {stop, Reason}

Initiates the server, loads the dispatch list into the webmachine dispatcher

reload/1

reload(Context) -> any()

Reload all dispatch lists. Finds new dispatch lists and adds them to the dispatcher

reload/2

reload(X1, Context) -> any()

start_link/1

start_link(SiteProps) -> {ok, Pid} | ignore | {error, Error}

Starts the dispatch server

terminate/2

terminate(Reason, State) -> void()

This function is called by a gen_server when it is about to terminate. It should be the opposite of Module:init/1 and do any necessary cleaning up. When it returns, the gen_server terminates with Reason. The return value is ignored.

update/1

update(Context) -> any()

Update the dispatch list but don't reload it yet. Used when flushing all sites, see z:flush/0

url_for/2

url_for(Name::atom(), Context) -> iolist()

Construct an uri from a named dispatch, assuming no parameters. Use html escape.

url_for/3

url_for(Name::atom(), Args, Context) -> iolist()

Construct an uri from a named dispatch and the parameters. Use html escape.

url_for/4

url_for(Name::atom(), Args, Escape::atom(), Context) -> iolist()

Construct an uri from a named dispatch and the parameters


Generated by EDoc, Oct 22 2014, 21:45:06.