| From | Sent On | Attachments |
|---|---|---|
| Paul Bowler | Oct 15, 2008 2:39 am | |
| Paul Bowler | Oct 17, 2008 12:29 am | |
| Mingfai | Oct 19, 2008 6:28 am | |
| Jason Morris | Oct 20, 2008 4:36 am | |
| Paul Bowler | Oct 20, 2008 7:00 am | |
| Mingfai | Oct 20, 2008 8:38 am | |
| Paul Bowler | Oct 20, 2008 8:44 am | |
| Mingfai | Oct 20, 2008 9:36 am | |
| Paul Bowler | Oct 20, 2008 10:21 am | |
| Mingfai | Oct 20, 2008 10:39 am | |
| Jason Morris | Oct 21, 2008 1:11 am | |
| Paul Bowler | Oct 21, 2008 1:57 am |
| Subject: | Re: [grails-user] Different views for different devices | |
|---|---|---|
| From: | Jason Morris (jaso...@torusit.com) | |
| Date: | Oct 21, 2008 1:11:41 am | |
| List: | org.codehaus.grails.user | |
I agree, a Filter is definitely the way to go for this - URLMappings is for, well, URL Mappings :)
Logic is better injected in a Filter, they are very elegant and simple. Just parse the headers and then set request.device, and it will be available in all your controllers via the request object.
More examples here: http://grails.org/Filters
Jason
On Mon, Oct 20, 2008 at 6:39 PM, Mingfai <ming...@gmail.com> wrote:
yes, you could use a Filter to set the variable. to detect device, you set the variable no matter what Url the device access. http://grails.org/doc/1.0.x/guide/6.%20The%20Web%20Layer.html#6.6%20Filters
On Tue, Oct 21, 2008 at 1:22 AM, Paul Bowler <paul...@yahoo.com>wrote:
I though I'd just need to set it somewhere - the UrlMappings seemed a good a place as any so it would be passed to any controller in a DRY way.
Any other suggestiosn gratefully received!
P.
----- Original Message ---- From: Mingfai <ming...@gmail.com> To: us...@grails.codehaus.org Sent: Monday, 20 October, 2008 17:37:04 Subject: Re: [grails-user] Different views for different devices
if you do detection by HTTP header, you could use the same url for different kind of device. so you don't need to anything with UrlMappings. do you need different URL for different device? how exactly you want to make your uri, controller , action and view? I think Grails is flexible enough to handle any need.
On Mon, Oct 20, 2008 at 11:44 PM, Paul Bowler <paul...@yahoo.com>wrote:
But how would I set this '$device' parameter in the UrlMappings.groovy using a regex? Paul.
[image: View Paul Bowler's profile on
LinkedIn]<http://www.linkedin.com/in/paulbowler>
----- Original Message ---- From: Mingfai <ming...@gmail.com> To: us...@grails.codehaus.org Sent: Monday, 20 October, 2008 16:38:51 Subject: Re: [grails-user] Different views for different devices
it all depends on how you will put your GSP. for me, i'm doing sth similar. my app detect the host name and use different gsp view for different host name. so, if you'll structure your gsp like: /search/iphone/main.gsp /search/gphone/main.gsp then you use variable to make the view as "search/$device/main"
for sure you could use another layout, such as: /search/main_iphone.gsp /search/main_gphone.gsp
just position your view expression differently. it's not an official way, but you could keep your controller and model transparent.
regards, mingfai
On Mon, Oct 20, 2008 at 10:01 PM, Paul Bowler <paul...@yahoo.com>wrote:
Many thanks both of you for the info. I'd already taken a look at content negotiation, but couldn't see how to use it for browser types - I'll take another look at this and filters.
Paul.
----- Original Message ---- From: Jason Morris <jaso...@torusit.com> To: us...@grails.codehaus.org Sent: Monday, 20 October, 2008 12:37:03 Subject: Re: [grails-user] Different views for different devices
I'd recommend that you read the Content Negotiation section of the reference manual: http://docs.huihoo.com/grails/1.0.3/guide/single.html#6.8%20Content%20Negotiation
It is kinda what you are looking for, would definitely be worth knowing about it.
Jason
On Sun, Oct 19, 2008 at 2:28 PM, Mingfai <ming...@gmail.com> wrote:
how about create a filter to do detection and set a variable. and when you render the view you include the variable in the view name?
On Fri, Oct 17, 2008 at 3:29 PM, Paul Bowler <paul...@yahoo.com>wrote:
Hi All,
Is there a simple way to auto-detect browser type (by regex pattern in the HTTP header for example) and, using this type, automatically render the appropriate view.
To give you some context, I'm busy developing a Grails mobile site for a high-profile client. This is currently optomised for the iPhone, but they want WML, Nokia and Blackberry versions too. The model and controller do not need to change, but I do need to implement different views for each device.
Thanks,
Paul.
Send instant messages to your online friends http://uk.messenger.yahoo.com
--------------------------------------------------------------------- To unsubscribe from this list, please visit:
Send instant messages to your online friends http://uk.messenger.yahoo.com
Send instant messages to your online friends http://uk.messenger.yahoo.com
Send instant messages to your online friends http://uk.messenger.yahoo.com





