z_dispatcher (zotonic_core v1.0.0-rc.17)
Manage dispatch lists (aka definitions for url patterns). Constructs named urls from dispatch lists.
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
Return the preferred hostname for the site
Handle casts.
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. Uses html escape.
Construct an uri from a named dispatch and the parameters. Uses html escape.
Construct an uri from a named dispatch and the parameters
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
-spec dispatchinfo(z:context() | pid() | atom()) -> {ok, DispatchInfo} | {error, noproc} when DispatchInfo :: #{site := atom(), hostname := binary() | undefined, smtphost := binary() | undefined, hostalias := [binary()], redirect := boolean(), dispatch_list := [z_sites_dispatcher:dispatch_rule()], page_paths := #{atom() | binary() => z_sites_dispatcher:dispatch_rsc_rule()}}.
Fetch the dispatchlist for the site.
Drop the portnumber from the hostname
Return the preferred hostname for the site
Handle casts.
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
-spec url_for(Name, Context) -> Url when Name :: atom() | binary(), Context :: z:context(), Url :: binary() | undefined.
Construct an uri from a named dispatch, assuming no parameters. Uses html escape.
-spec url_for(Name, Args, Context) -> Url when Name :: atom() | binary(), Args :: proplists:proplist(), Context :: z:context(), Url :: binary() | undefined.
Construct an uri from a named dispatch and the parameters. Uses html escape.
-spec url_for(Name, Args, Escape, Context) -> Url when Name :: atom() | binary(), Args :: proplists:proplist(), Escape :: html | xml | none, Context :: z:context(), Url :: binary() | undefined.
Construct an uri from a named dispatch and the parameters