/doc/core/z_dispatcher.html
https://code.google.com/p/zotonic/ · HTML · 140 lines · 118 code · 22 blank · 0 comment · 0 complexity · 5bc6e62b9b2e4e1ac36a37fe5b0b85fe MD5 · raw file
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <title>Module z_dispatcher</title>
- <link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
- </head>
- <body bgcolor="white">
- <div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
- <hr>
- <h1>Module z_dispatcher</h1>
- <ul class="index"><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>Manage dispatch lists (aka definitions for url patterns).
- <p>Copyright 2009 Marc Worrell
- </p>
- <p><b>Behaviours:</b> <a href="gen_server.html"><tt>gen_server</tt></a>.</p>
- <p><b>Authors:</b> Marc Worrell (<a href="mailto:marc@worrell.nl"><tt>marc@worrell.nl</tt></a>).</p>
- <h2><a name="description">Description</a></h2>Manage dispatch lists (aka definitions for url patterns). Constructs named urls from dispatch lists.
- <h2><a name="index">Function Index</a></h2>
- <table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#code_change-3">code_change/3</a></td><td>Convert process state when code is changed.</td></tr>
- <tr><td valign="top"><a href="#dispatchinfo-1">dispatchinfo/1</a></td><td>Fetch the dispatchlist for the site.</td></tr>
- <tr><td valign="top"><a href="#drop_port-1">drop_port/1</a></td><td>Drop the portnumber from the hostname.</td></tr>
- <tr><td valign="top"><a href="#handle_call-3">handle_call/3</a></td><td>Create the url for the dispatch rule with name and arguments Args.</td></tr>
- <tr><td valign="top"><a href="#handle_cast-2">handle_cast/2</a></td><td></td></tr>
- <tr><td valign="top"><a href="#handle_info-2">handle_info/2</a></td><td>Handling all non call/cast messages.</td></tr>
- <tr><td valign="top"><a href="#hostname-1">hostname/1</a></td><td>Fetch the preferred hostname for this site.</td></tr>
- <tr><td valign="top"><a href="#hostname_port-1">hostname_port/1</a></td><td>Fetch the preferred hostname, including port, for this site.</td></tr>
- <tr><td valign="top"><a href="#init-1">init/1</a></td><td>Initiates the server, loads the dispatch list into the webmachine dispatcher.</td></tr>
- <tr><td valign="top"><a href="#reload-1">reload/1</a></td><td>Reload all dispatch lists.</td></tr>
- <tr><td valign="top"><a href="#reload-2">reload/2</a></td><td></td></tr>
- <tr><td valign="top"><a href="#start_link-1">start_link/1</a></td><td>Starts the dispatch server.</td></tr>
- <tr><td valign="top"><a href="#terminate-2">terminate/2</a></td><td>This function is called by a gen_server when it is about to
- terminate.</td></tr>
- <tr><td valign="top"><a href="#update-1">update/1</a></td><td>Update the dispatch list but don't reload it yet.</td></tr>
- <tr><td valign="top"><a href="#url_for-2">url_for/2</a></td><td>Construct an uri from a named dispatch, assuming no parameters.</td></tr>
- <tr><td valign="top"><a href="#url_for-3">url_for/3</a></td><td>Construct an uri from a named dispatch and the parameters.</td></tr>
- <tr><td valign="top"><a href="#url_for-4">url_for/4</a></td><td>Construct an uri from a named dispatch and the parameters.</td></tr>
- </table>
- <h2><a name="functions">Function Details</a></h2>
- <h3 class="function"><a name="code_change-3">code_change/3</a></h3>
- <div class="spec">
- <p><tt>code_change(OldVsn, State, Extra) -> {ok, NewState}</tt></p>
- </div><p>Convert process state when code is changed</p>
- <h3 class="function"><a name="dispatchinfo-1">dispatchinfo/1</a></h3>
- <div class="spec">
- <p><tt>dispatchinfo(Context) -> {host, hostname, streamhost, smtphost, hostaliases, redirect, dispatchlist}</tt></p>
- </div><p>Fetch the dispatchlist for the site.</p>
- <h3 class="function"><a name="drop_port-1">drop_port/1</a></h3>
- <div class="spec">
- <p><tt>drop_port(Hostname) -> any()</tt></p>
- </div><p>Drop the portnumber from the hostname
- </p>
- <h3 class="function"><a name="handle_call-3">handle_call/3</a></h3>
- <div class="spec">
- <p><tt>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}</tt></p>
- </div><p>Create the url for the dispatch rule with name and arguments Args.</p>
- <h3 class="function"><a name="handle_cast-2">handle_cast/2</a></h3>
- <div class="spec">
- <p><tt>handle_cast(Msg, State) -> {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}</tt></p>
- </div>
- <h3 class="function"><a name="handle_info-2">handle_info/2</a></h3>
- <div class="spec">
- <p><tt>handle_info(Info, State) -> {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}</tt></p>
- </div><p>Handling all non call/cast messages</p>
- <h3 class="function"><a name="hostname-1">hostname/1</a></h3>
- <div class="spec">
- <p><tt>hostname(Context) -> <a href="#type-iolist">iolist()</a></tt></p>
- </div><p>Fetch the preferred hostname for this site</p>
- <h3 class="function"><a name="hostname_port-1">hostname_port/1</a></h3>
- <div class="spec">
- <p><tt>hostname_port(Context) -> <a href="#type-iolist">iolist()</a></tt></p>
- </div><p>Fetch the preferred hostname, including port, for this site</p>
- <h3 class="function"><a name="init-1">init/1</a></h3>
- <div class="spec">
- <p><tt>init(SiteProps::Args) -> {ok, State} | {ok, State, Timeout} | ignore | {stop, Reason}</tt></p>
- </div><p>Initiates the server, loads the dispatch list into the webmachine dispatcher</p>
- <h3 class="function"><a name="reload-1">reload/1</a></h3>
- <div class="spec">
- <p><tt>reload(Context) -> any()</tt></p>
- </div><p>Reload all dispatch lists. Finds new dispatch lists and adds them to the dispatcher</p>
- <h3 class="function"><a name="reload-2">reload/2</a></h3>
- <div class="spec">
- <p><tt>reload(X1, Context) -> any()</tt></p>
- </div>
- <h3 class="function"><a name="start_link-1">start_link/1</a></h3>
- <div class="spec">
- <p><tt>start_link(SiteProps) -> {ok, Pid} | ignore | {error, Error}</tt></p>
- </div><p>Starts the dispatch server</p>
- <h3 class="function"><a name="terminate-2">terminate/2</a></h3>
- <div class="spec">
- <p><tt>terminate(Reason, State) -> <a href="#type-void">void()</a></tt></p>
- </div><p>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.</p>
- <h3 class="function"><a name="update-1">update/1</a></h3>
- <div class="spec">
- <p><tt>update(Context) -> any()</tt></p>
- </div><p>Update the dispatch list but don't reload it yet. Used when flushing all sites, see z:flush/0</p>
- <h3 class="function"><a name="url_for-2">url_for/2</a></h3>
- <div class="spec">
- <p><tt>url_for(Name::atom(), Context) -> <a href="#type-iolist">iolist()</a></tt></p>
- </div><p>Construct an uri from a named dispatch, assuming no parameters. Use html escape.</p>
- <h3 class="function"><a name="url_for-3">url_for/3</a></h3>
- <div class="spec">
- <p><tt>url_for(Name::atom(), Args, Context) -> <a href="#type-iolist">iolist()</a></tt>
- <ul class="definitions"><li><tt>Args = <a href="#type-proplist">proplist()</a></tt></li>
- </ul></p>
- </div><p>Construct an uri from a named dispatch and the parameters. Use html escape.</p>
- <h3 class="function"><a name="url_for-4">url_for/4</a></h3>
- <div class="spec">
- <p><tt>url_for(Name::atom(), Args, Escape::atom(), Context) -> <a href="#type-iolist">iolist()</a></tt>
- <ul class="definitions"><li><tt>Args = <a href="#type-proplist">proplist()</a></tt></li>
- </ul></p>
- </div><p>Construct an uri from a named dispatch and the parameters</p>
- <hr>
- <div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
- <p><i>Generated by EDoc, Aug 12 2011, 20:01:39.</i></p>
- </body>
- </html>