PageRenderTime 27ms CodeModel.GetById 13ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/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
  1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2<html>
  3<head>
  4<title>Module z_dispatcher</title>
  5<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
  6</head>
  7<body bgcolor="white">
  8<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>
  9<hr>
 10
 11<h1>Module z_dispatcher</h1>
 12<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).
 13<p>Copyright Š 2009 Marc Worrell
 14 </p>
 15
 16<p><b>Behaviours:</b> <a href="gen_server.html"><tt>gen_server</tt></a>.</p>
 17<p><b>Authors:</b> Marc Worrell (<a href="mailto:marc@worrell.nl"><tt>marc@worrell.nl</tt></a>).</p>
 18
 19<h2><a name="description">Description</a></h2>Manage dispatch lists (aka definitions for url patterns). Constructs named urls from dispatch lists.
 20<h2><a name="index">Function Index</a></h2>
 21<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>
 22<tr><td valign="top"><a href="#dispatchinfo-1">dispatchinfo/1</a></td><td>Fetch the dispatchlist for the site.</td></tr>
 23<tr><td valign="top"><a href="#drop_port-1">drop_port/1</a></td><td>Drop the portnumber from the hostname.</td></tr>
 24<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>
 25<tr><td valign="top"><a href="#handle_cast-2">handle_cast/2</a></td><td></td></tr>
 26<tr><td valign="top"><a href="#handle_info-2">handle_info/2</a></td><td>Handling all non call/cast messages.</td></tr>
 27<tr><td valign="top"><a href="#hostname-1">hostname/1</a></td><td>Fetch the preferred hostname for this site.</td></tr>
 28<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>
 29<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>
 30<tr><td valign="top"><a href="#reload-1">reload/1</a></td><td>Reload all dispatch lists.</td></tr>
 31<tr><td valign="top"><a href="#reload-2">reload/2</a></td><td></td></tr>
 32<tr><td valign="top"><a href="#start_link-1">start_link/1</a></td><td>Starts the dispatch server.</td></tr>
 33<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
 34  terminate.</td></tr>
 35<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>
 36<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>
 37<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>
 38<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>
 39</table>
 40
 41<h2><a name="functions">Function Details</a></h2>
 42
 43<h3 class="function"><a name="code_change-3">code_change/3</a></h3>
 44<div class="spec">
 45<p><tt>code_change(OldVsn, State, Extra) -&gt; {ok, NewState}</tt></p>
 46</div><p>Convert process state when code is changed</p>
 47
 48<h3 class="function"><a name="dispatchinfo-1">dispatchinfo/1</a></h3>
 49<div class="spec">
 50<p><tt>dispatchinfo(Context) -&gt; {host, hostname, streamhost, smtphost, hostaliases, redirect, dispatchlist}</tt></p>
 51</div><p>Fetch the dispatchlist for the site.</p>
 52
 53<h3 class="function"><a name="drop_port-1">drop_port/1</a></h3>
 54<div class="spec">
 55<p><tt>drop_port(Hostname) -&gt; any()</tt></p>
 56</div><p>Drop the portnumber from the hostname
 57</p>
 58
 59<h3 class="function"><a name="handle_call-3">handle_call/3</a></h3>
 60<div class="spec">
 61<p><tt>handle_call(X1::Request, From, State) -&gt; {reply, Reply, State} | {reply, Reply, State, Timeout} | {noreply, State} | {noreply, State, Timeout} | {stop, Reason, Reply, State} | {stop, Reason, State}</tt></p>
 62</div><p>Create the url for the dispatch rule with name and arguments Args.</p>
 63
 64<h3 class="function"><a name="handle_cast-2">handle_cast/2</a></h3>
 65<div class="spec">
 66<p><tt>handle_cast(Msg, State) -&gt; {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}</tt></p>
 67</div>
 68
 69<h3 class="function"><a name="handle_info-2">handle_info/2</a></h3>
 70<div class="spec">
 71<p><tt>handle_info(Info, State) -&gt; {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}</tt></p>
 72</div><p>Handling all non call/cast messages</p>
 73
 74<h3 class="function"><a name="hostname-1">hostname/1</a></h3>
 75<div class="spec">
 76<p><tt>hostname(Context) -&gt; <a href="#type-iolist">iolist()</a></tt></p>
 77</div><p>Fetch the preferred hostname for this site</p>
 78
 79<h3 class="function"><a name="hostname_port-1">hostname_port/1</a></h3>
 80<div class="spec">
 81<p><tt>hostname_port(Context) -&gt; <a href="#type-iolist">iolist()</a></tt></p>
 82</div><p>Fetch the preferred hostname, including port, for this site</p>
 83
 84<h3 class="function"><a name="init-1">init/1</a></h3>
 85<div class="spec">
 86<p><tt>init(SiteProps::Args) -&gt; {ok, State} | {ok, State, Timeout} | ignore | {stop, Reason}</tt></p>
 87</div><p>Initiates the server, loads the dispatch list into the webmachine dispatcher</p>
 88
 89<h3 class="function"><a name="reload-1">reload/1</a></h3>
 90<div class="spec">
 91<p><tt>reload(Context) -&gt; any()</tt></p>
 92</div><p>Reload all dispatch lists.  Finds new dispatch lists and adds them to the dispatcher</p>
 93
 94<h3 class="function"><a name="reload-2">reload/2</a></h3>
 95<div class="spec">
 96<p><tt>reload(X1, Context) -&gt; any()</tt></p>
 97</div>
 98
 99<h3 class="function"><a name="start_link-1">start_link/1</a></h3>
100<div class="spec">
101<p><tt>start_link(SiteProps) -&gt; {ok, Pid} | ignore | {error, Error}</tt></p>
102</div><p>Starts the dispatch server</p>
103
104<h3 class="function"><a name="terminate-2">terminate/2</a></h3>
105<div class="spec">
106<p><tt>terminate(Reason, State) -&gt; <a href="#type-void">void()</a></tt></p>
107</div><p>This function is called by a gen_server when it is about to
108  terminate. It should be the opposite of Module:init/1 and do any necessary
109  cleaning up. When it returns, the gen_server terminates with Reason.
110  The return value is ignored.</p>
111
112<h3 class="function"><a name="update-1">update/1</a></h3>
113<div class="spec">
114<p><tt>update(Context) -&gt; any()</tt></p>
115</div><p>Update the dispatch list but don't reload it yet. Used when flushing all sites, see z:flush/0</p>
116
117<h3 class="function"><a name="url_for-2">url_for/2</a></h3>
118<div class="spec">
119<p><tt>url_for(Name::atom(), Context) -&gt; <a href="#type-iolist">iolist()</a></tt></p>
120</div><p>Construct an uri from a named dispatch, assuming no parameters. Use html escape.</p>
121
122<h3 class="function"><a name="url_for-3">url_for/3</a></h3>
123<div class="spec">
124<p><tt>url_for(Name::atom(), Args, Context) -&gt; <a href="#type-iolist">iolist()</a></tt>
125<ul class="definitions"><li><tt>Args = <a href="#type-proplist">proplist()</a></tt></li>
126</ul></p>
127</div><p>Construct an uri from a named dispatch and the parameters. Use html escape.</p>
128
129<h3 class="function"><a name="url_for-4">url_for/4</a></h3>
130<div class="spec">
131<p><tt>url_for(Name::atom(), Args, Escape::atom(), Context) -&gt; <a href="#type-iolist">iolist()</a></tt>
132<ul class="definitions"><li><tt>Args = <a href="#type-proplist">proplist()</a></tt></li>
133</ul></p>
134</div><p>Construct an uri from a named dispatch and the parameters</p>
135<hr>
136
137<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>
138<p><i>Generated by EDoc, Aug 12 2011, 20:01:39.</i></p>
139</body>
140</html>