<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" > <channel><title>Comments on: Grails: alternate views for mobile (iPhone) clients</title> <atom:link href="http://adammonsen.com/post/548/feed" rel="self" type="application/rss+xml" /><link>http://adammonsen.com/post/548?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=grails-alternate-views-for-mobile-iphone-clients</link> <description></description> <lastBuildDate>Tue, 03 Jan 2012 20:12:25 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Przemyslaw</title><link>http://adammonsen.com/post/548/comment-page-1#comment-12129</link> <dc:creator>Przemyslaw</dc:creator> <pubDate>Wed, 14 Jul 2010 19:18:21 +0000</pubDate> <guid isPermaLink="false">http://adammonsen.com/?p=548#comment-12129</guid> <description>But in the meanwhile I discovered, that this only helps to resolve the layout gsp, not the view mapping convention.Probably you can use normal spring interceptors http://www.vaannila.com/spring/spring-interceptor.html That would be like your approach, but a little bit more DRY ( so without adding afterInterceptor for every controller).But I am still not sure about the best approach for this task.</description> <content:encoded><![CDATA[<p>But in the meanwhile I discovered, that this only helps to resolve the layout gsp, not the view mapping convention.</p><p>Probably you can use normal spring interceptors <a href="http://www.vaannila.com/spring/spring-interceptor.html" rel="nofollow">http://www.vaannila.com/spring/spring-interceptor.html</a><br /> That would be like your approach, but a little bit more DRY ( so without adding afterInterceptor for every controller).</p><p>But I am still not sure about the best approach for this task.</p> ]]></content:encoded> </item> <item><title>By: adam</title><link>http://adammonsen.com/post/548/comment-page-1#comment-12127</link> <dc:creator>adam</dc:creator> <pubDate>Wed, 14 Jul 2010 19:10:54 +0000</pubDate> <guid isPermaLink="false">http://adammonsen.com/?p=548#comment-12127</guid> <description>Thanks for your comments, folks!@Przemyslaw - I fixed your HTML sample. I had to wrap it in &lt;pre lang=&quot;html&quot;&gt;&lt;/pre&gt;</description> <content:encoded><![CDATA[<p>Thanks for your comments, folks!</p><p>@Przemyslaw &#8211; I fixed your HTML sample. I had to wrap it in &lt;pre lang=&#8221;html&#8221;&gt;&lt;/pre&gt;</p> ]]></content:encoded> </item> <item><title>By: Przemyslaw</title><link>http://adammonsen.com/post/548/comment-page-1#comment-12126</link> <dc:creator>Przemyslaw</dc:creator> <pubDate>Wed, 14 Jul 2010 12:37:56 +0000</pubDate> <guid isPermaLink="false">http://adammonsen.com/?p=548#comment-12126</guid> <description>Thanks for this post and thanks Rich Kroll for the sitemesh decorator mapper hint.I like the sitemesh way, cause there is already a sitemesh AgentDecoratorMapper.So I simply extended the sitemesh.xml with&lt;pre lang=&quot;html&quot;&gt; &lt;decorator-mappers&gt; &lt;mapper class=&quot;com.opensymphony.module.sitemesh.mapper.AgentDecoratorMapper&quot; &gt; &lt;param name=&quot;match.iPhone&quot; value=&quot;mobile&quot; /&gt; &lt;/mapper&gt; &lt;mapper class=&quot;org.codehaus.groovy.grails.web.sitemesh.GrailsLayoutDecoratorMapper&quot; /&gt; &lt;/decorator-mappers&gt; &lt;/pre&gt;Thats all you have to do. Now sitemesh tries first to resolve your view-mobile.gsp and fallback to view.gsp if it does not find any view-mobile.gsp</description> <content:encoded><![CDATA[<p>Thanks for this post and thanks Rich Kroll for the sitemesh decorator mapper hint.</p><p>I like the sitemesh way, cause there is already a sitemesh AgentDecoratorMapper.</p><p>So I simply extended the sitemesh.xml with</p><div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;decorator-mappers&gt;
  &lt;mapper class=&quot;com.opensymphony.module.sitemesh.mapper.AgentDecoratorMapper&quot; &gt;
    &lt;param name=&quot;match.iPhone&quot; value=&quot;mobile&quot; /&gt;
  &lt;/mapper&gt;
  &lt;mapper class=&quot;org.codehaus.groovy.grails.web.sitemesh.GrailsLayoutDecoratorMapper&quot; /&gt;
&lt;/decorator-mappers&gt;</pre></div></div><p>Thats all you have to do. Now sitemesh tries first to resolve your view-mobile.gsp and fallback to view.gsp if it does not find any view-mobile.gsp</p> ]]></content:encoded> </item> <item><title>By: Mark P</title><link>http://adammonsen.com/post/548/comment-page-1#comment-12125</link> <dc:creator>Mark P</dc:creator> <pubDate>Wed, 14 Jul 2010 02:15:13 +0000</pubDate> <guid isPermaLink="false">http://adammonsen.com/?p=548#comment-12125</guid> <description>Very useful post! Thanks! I definitely would recommend creating a BaseController class and having your controllers extend that class. If you don&#039;t want to do that, and you are using the scaffolded controllers, you should look at the &quot;grails install-templates&quot; command and modify the controller template that is used there. Adding the method to that template will cause all newly generate controllers to have the method.</description> <content:encoded><![CDATA[<p>Very useful post! Thanks! I definitely would recommend creating a BaseController class and having your controllers extend that class. If you don&#8217;t want to do that, and you are using the scaffolded controllers, you should look at the &#8220;grails install-templates&#8221; command and modify the controller template that is used there. Adding the method to that template will cause all newly generate controllers to have the method.</p> ]]></content:encoded> </item> <item><title>By: Rich Kroll</title><link>http://adammonsen.com/post/548/comment-page-1#comment-12101</link> <dc:creator>Rich Kroll</dc:creator> <pubDate>Wed, 28 Apr 2010 14:22:29 +0000</pubDate> <guid isPermaLink="false">http://adammonsen.com/?p=548#comment-12101</guid> <description>Nice post!  I agree with the previous commenter, IMO sitemesh would be a better approach to this problem.  You could add a MobileDecoratorMapper to the sitemesh.xml, and have the mapper inspect the user agent string to select different layouts.  If you need different content displayed to mobile users, then your approach would be the preferable way to manage things.  Great topic, thanks for sharing!</description> <content:encoded><![CDATA[<p>Nice post!  I agree with the previous commenter, IMO sitemesh would be a better approach to this problem.  You could add a MobileDecoratorMapper to the sitemesh.xml, and have the mapper inspect the user agent string to select different layouts.  If you need different content displayed to mobile users, then your approach would be the preferable way to manage things.  Great topic, thanks for sharing!</p> ]]></content:encoded> </item> <item><title>By: JT</title><link>http://adammonsen.com/post/548/comment-page-1#comment-12097</link> <dc:creator>JT</dc:creator> <pubDate>Sun, 25 Apr 2010 12:55:09 +0000</pubDate> <guid isPermaLink="false">http://adammonsen.com/?p=548#comment-12097</guid> <description>Nice post.  I wonder if you could have your controllers extend a base class with the closure.I&#039;ve thought about this problem too. I haven&#039;t tried it yet - but was planning to use different sitemesh templates for mobile clients.  In theory the views would be generic, and via sitemesh templates, different formatting (css includes) could be applied.  The goal of my thinking is to apply a little DRY and avoid replication of code by not having diff GSPs for different clients.</description> <content:encoded><![CDATA[<p>Nice post.  I wonder if you could have your controllers extend a base class with the closure.</p><p>I&#8217;ve thought about this problem too. I haven&#8217;t tried it yet &#8211; but was planning to use different sitemesh templates for mobile clients.  In theory the views would be generic, and via sitemesh templates, different formatting (css includes) could be applied.  The goal of my thinking is to apply a little DRY and avoid replication of code by not having diff GSPs for different clients.</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: adammonsen.com @ 2012-02-11 00:16:48 -->
