This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Well, lets step back a little bit and explain your requirement. Resources typically should not be identified by query parameter values, they should are addressed by a request URI. So I'm not sure preserving parameters through the redirect is ideal here, honestly (sending the site_preference parameter through the redirect is definitely not ideal, after it's already stored in the cookie).

To your second point: why aren't cookies good enough? Do you really want to rely on a query parameter to be present on every request to force the mobile site? Wouldn't you have to rewrite each URL generated by your view templates with site_preference=mobile then?

Keith

Comment

for usecase 2,
1) for case of web applications, IMHO, it is not a good practice to hard code the site names (e.g testdomain.com, m.testdomain.com) into the web application. may this is fine for web sites.
We usually delivery the web.war to our clients and it supports both browser based and mobile based agents. The context root is alway relative path. http://localhost:8080/web is for browsers and http://localhost:8080/web/*?m=true is the mobile version; as well as cookie store.