You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by david <sn...@hotmail.com> on 2012/02/11 16:55:14 UTC
Serving different content depending on User Agent
I would like to know what is the best way to serve slightly different content
depending on the User Agent string coming from the browser.
Is there a way to do this at the application level, eg by doing page
mounting and targeting different WebPage's, or some other general
redirection technique, or should I just keep unique WebPage's but add
specific logic to handle the special cases within each one? For example
WebClientInfo w = new WebClientInfo(getRequestCycle());
if(w.getUserAgent().contains("...")) {
// do something special
}
else {
// otherwise the general case
}
Many thanks
David
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Serving-different-content-depending-on-User-Agent-tp4379183p4379183.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
RE: Serving different content depending on User Agent
Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> Could someone explain the meaning of the string argument to Session.setStyle()?
It's used in parsing resource names, and often in code as well, e.g. hiding detail views for mobile browsing.
If you have a Locale of "no_NO" and a style of "mobile" Wicket will look for e.g. MyPage_mobile_no_NO.html etc.
https://cwiki.apache.org/WICKET/localization-and-skinning-of-applications.html
- Tor Iver
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Serving different content depending on User Agent
Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Also there is:
https://cwiki.apache.org/WICKET/localization-and-skinning-of-applications.html
https://cwiki.apache.org/OOOUSERS/branding-style-guide.html
2012/2/19 Jeremy Thomerson <je...@wickettraining.com>:
> On Mon, Feb 13, 2012 at 8:21 AM, Richard W. Adams <RW...@up.com> wrote:
>
>> Could someone explain the meaning of the string argument to
>> Session.setStyle()? Unfortunately, the javadocs give no clue, other saying
>> that a "skin" can be used. Is the string the name of a stylesheet file, or
>> something else?
>>
>> Note to Wicket team: The Wicket Javadocs are woefully inadequate. Time
>> invested in fleshing them out would be well spent & would prevent a lot of
>> questions like this.
>>
>
> Patches welcome.
>
> Of course, Javadocs can always be improved, but your statement that they
> will "prevent a lot of questions like this" isn't necessarily true. I've
> been on lots of mailing lists over the years and it doesn't matter how good
> the javadocs are, there are still questions. Most people don't look at
> the javadocs.
>
> Did you actually read the entire javadoc? The setStyle javadocs give you a
> link to the Session (class) javadocs. These docs explain what style is and
> then give a long list of exactly how all the resources are loaded -
> including the style parameter and how it effects resource names. If you
> see something that can be improved there, please by all means submit a
> patch or even an email that says "please add such-and-such".
>
> --
> Jeremy Thomerson
> http://wickettraining.com
> *Need a CMS for Wicket? Use Brix! http://brixcms.org*
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Serving different content depending on User Agent
Posted by Jeremy Thomerson <je...@wickettraining.com>.
On Mon, Feb 13, 2012 at 8:21 AM, Richard W. Adams <RW...@up.com> wrote:
> Could someone explain the meaning of the string argument to
> Session.setStyle()? Unfortunately, the javadocs give no clue, other saying
> that a "skin" can be used. Is the string the name of a stylesheet file, or
> something else?
>
> Note to Wicket team: The Wicket Javadocs are woefully inadequate. Time
> invested in fleshing them out would be well spent & would prevent a lot of
> questions like this.
>
Patches welcome.
Of course, Javadocs can always be improved, but your statement that they
will "prevent a lot of questions like this" isn't necessarily true. I've
been on lots of mailing lists over the years and it doesn't matter how good
the javadocs are, there are still questions. Most people don't look at
the javadocs.
Did you actually read the entire javadoc? The setStyle javadocs give you a
link to the Session (class) javadocs. These docs explain what style is and
then give a long list of exactly how all the resources are loaded -
including the style parameter and how it effects resource names. If you
see something that can be improved there, please by all means submit a
patch or even an email that says "please add such-and-such".
--
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket? Use Brix! http://brixcms.org*
RE: Serving different content depending on User Agent
Posted by "Richard W. Adams" <RW...@UP.COM>.
Could someone explain the meaning of the string argument to
Session.setStyle()? Unfortunately, the javadocs give no clue, other saying
that a "skin" can be used. Is the string the name of a stylesheet file, or
something else?
Note to Wicket team: The Wicket Javadocs are woefully inadequate. Time
invested in fleshing them out would be well spent & would prevent a lot of
questions like this.
From: Wilhelmsen Tor Iver <To...@arrive.no>
To: "users@wicket.apache.org" <us...@wicket.apache.org>
Date: 02/13/2012 02:07 AM
Subject: RE: Serving different content depending on User Agent
> I would like to know what is the best way to serve slightly different
content depending on the User Agent string coming from the browser.
You can pick it up in Application.newRequestCycle() or
WebApplication.newWebRequest(), and use it to pick a value for
Session.setStyle() and then use that style in your template- and resource
names. For more advanced selection of content, use the selected value in a
custom URL mapper.
- Tor Iver
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
**
This email and any attachments may contain information that is confidential and/or privileged for the sole use of the intended recipient. Any use, review, disclosure, copying, distribution or reliance by others, and any forwarding of this email or its contents, without the express permission of the sender is strictly prohibited by law. If you are not the intended recipient, please contact the sender immediately, delete the e-mail and destroy all copies.
**
RE: Serving different content depending on User Agent
Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> I would like to know what is the best way to serve slightly different content depending on the User Agent string coming from the browser.
You can pick it up in Application.newRequestCycle() or WebApplication.newWebRequest(), and use it to pick a value for Session.setStyle() and then use that style in your template- and resource names. For more advanced selection of content, use the selected value in a custom URL mapper.
- Tor Iver
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org