z_dispatcher (zotonic_core v1.0.0-rc.11)

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

Link to this section Summary

Functions

Make the url an absolute url
Convert process state when code is changed
A list of dispatch rule arguments that shouldn't be considered with redirects. Used by controller_file_id and controller_redirect
Fetch the dispatchlist for the site.
Drop the portnumber from the hostname
Create the url for the dispatch rule with name and arguments Args.
Handling all non call/cast messages
Fetch the preferred hostname for this site
Fetch the preferred hostname, including port, for this site
Fetch the preferred hostname for SSL, including port, for this site
Initiates the server, loads the dispatch list into the webmachine dispatcher
Reload all dispatch lists. Finds new dispatch lists and adds them to the dispatcher
Starts the dispatch server
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 the dispatch list but don't reload it yet. Used when flushing all sites, see z:flush/0
Construct an uri from a named dispatch, assuming no parameters. Use html escape.
Construct an uri from a named dispatch and the parameters. Use html escape.
Construct an uri from a named dispatch and the parameters

Link to this section Functions

Link to this function

abs_url(Url, Context)

Make the url an absolute url
Link to this function

code_change(OldVsn, State, Extra)

Convert process state when code is changed
Link to this function

dispatcher_args()

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

dispatchinfo(Context)

-spec dispatchinfo(z:context() | pid() | atom()) ->
                {ok,
                 {atom(), binary() | string(), binary() | string(), list(), boolean(), list()}} |
                {error, noproc}.
Fetch the dispatchlist for the site.
Link to this function

drop_port(Hostname)

-spec drop_port(undefined | none | string() | binary()) -> undefined | binary().
Drop the portnumber from the hostname
Link to this function

handle_call(_, From, State)

Create the url for the dispatch rule with name and arguments Args.
Link to this function

handle_cast(Msg, State)

Link to this function

handle_info(Info, State)

Handling all non call/cast messages
Link to this function

hostname(Context)

-spec hostname(z:context()) -> binary() | undefined.
Fetch the preferred hostname for this site
Link to this function

hostname_port(Context)

-spec hostname_port(z:context()) -> binary() | undefined.
Fetch the preferred hostname, including port, for this site
Link to this function

hostname_ssl_port(Context)

-spec hostname_ssl_port(z:context()) -> binary() | undefined.
Fetch the preferred hostname for SSL, including port, for this site
Initiates the server, loads the dispatch list into the webmachine dispatcher
Link to this function

reload(Context)

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

reload(_, Context)

Link to this function

start_link(Site)

Starts the dispatch server
Link to this function

terminate(Reason, State)

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.
Link to this function

update(Context)

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

url_for(Name, Context)

Construct an uri from a named dispatch, assuming no parameters. Use html escape.
Link to this function

url_for(Name, Args, Context)

Construct an uri from a named dispatch and the parameters. Use html escape.
Link to this function

url_for(Name, Args, Escape, Context)

Construct an uri from a named dispatch and the parameters