<?xml version="1.0"?>
<rss version="2.0">
<channel>
<link>http://helma.org/wiki/Helma+NG/New+Regexp+based+URL+dispatching/</link>
<title>helma.org/wiki/Helma NG/New Regexp based URL dispatching</title>
<description>Updates for Page helma.org/wiki/Helma NG/New Regexp based URL dispatching</description>
<pubDate>Thu, 24 May 2012 04:38:12 +0000</pubDate>
<item>
<title>Version 2</title>
<link>http://helma.org/wiki/Helma+NG/New+Regexp+based+URL+dispatching/history.diff?v=2</link>
<description>&lt;div class=&#39;diffbody&#39;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;28&lt;/td&gt;&lt;td&gt; function archive(req, res, year, &lt;span class=&#39;diffremoved&#39;&gt;date) &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;month) &lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<pubDate>Fri, 26 Sep 2008 22:46:15 +0000</pubDate>
<author>hannes</author>
</item>
<item>
<title>Version 1</title>
<link>http://helma.org/wiki/Helma+NG/New+Regexp+based+URL+dispatching/history.diff?v=1</link>
<description>&lt;ul class=&#39;diffproperties&#39;&gt;&lt;li&gt;Set &lt;span class=&#39;diffpropname&#39;&gt;tags&lt;/span&gt; to &lt;span class=&#39;diffadded&#39;&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&#39;diffbody&#39;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;1&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;Starting today, Helma NG resolves URLs of incoming requests using a regular expression based scheme rather than by looking for functions with an &amp;lt;code&amp;gt;_action&amp;lt;/code&amp;gt; suffix. The request handler looks for an array called &amp;lt;code&amp;gt;urls&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;setup&amp;lt;/code&amp;gt; module with the following format:&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;3&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt; var urls = [&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;4&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; [ /^$/, &#39;main.index&#39; ],&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;5&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; [ /^skins$/, &#39;main.skins&#39; ],&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;6&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; [ /^mount\/point/, &#39;webmodule.index&#39; ],&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;7&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; [ /^continuation/, &#39;main.continuation&#39; ],&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;8&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; [ /^logging/, &#39;main.logging&#39; ], &lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;9&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt; ];&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;10&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;11&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;Each line contains a sub-array containing a pattern-action pair consisting of a regular expression and a module/function name. If the URI path of the incoming request matches the regular expression, the specified module is loaded and the function invoked. &lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;12&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;13&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;Note that it is also possible to define the pattern as string, and the action as function object like so:&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;14&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;15&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt; var main = loadModule(&#39;main&#39;);&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;16&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;17&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt; var urls = [&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;18&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; [ &amp;quot;^$&amp;quot;,&amp;nbsp; main.index ]&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;19&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt; ];&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;20&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;21&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;It is possible to capture parts of the request path and pass them to the action as additional arguments. For example, the following pattern will cause the action to receive two additional arguments consisting of 4 and 2 digits, respectively, if matched:&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;22&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;23&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt; var urls = [&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;24&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; [ /archive\/(\d{4})\/(\d{2}$/, &#39;main.archive&#39; ]&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;25&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;26&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;The function declaration of the archive action could look like this:&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;27&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;28&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt; function archive(req, res, year, date) {&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;29&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp;  ...&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;30&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt; }&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;31&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;32&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;I have plans for extending the facilities for passing additional arguments to the action, like defining static/literal arguments or packing the regexp groups into objects or arrays. Let me know what your ideas are, and watch this page for updates. -hns&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<pubDate>Fri, 26 Sep 2008 22:30:51 +0000</pubDate>
<author>hannes</author>
</item>
</channel>
</rss>

