Announcement Announcement Module
No announcement yet.
urlPath SiteSwitcher - more control over url change Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • urlPath SiteSwitcher - more control over url change


    I'm using spring-mobile (1.1.1.RELEASE) in an app and it is achieving most of what I require however I would like to find out if it is possible to have more fine-grained control over how urlPath SiteSwitcher is working.

    My requirement is that I am bringing multi-device views to a larger app where I have little or no control over rewrite rules in a production environment, and would like to be able to control how the mobile and tablet variants on paths are created, for instance that they be suffixed rather than prefixed or even use a regex replacement.

    I also need to have a fallback scenario that will follow the original controller path if there is no mapping for the tablet / mobile path. The goal is that optionally certain urls may be serviced by a separate controller that performs much lighter-weight processing for a cut-down display on smaller devices. Is there a clever way I could do this and still retain all the other benefits of user site preference etc. An example url might be
    would be translated by the SiteSwitcher to
    I am unable to change the
    portion of the urls due to infrastructure issues.

    Many thanks.


  • #2
    I found a workable solution to this - the siteSwitcher does some pretty smart swapping of the normal url such that I could more fully qualify the path to get the functionality I was looking for. A fallback testing for configured urls before redirect would still be a great option. Also server-side forwarding rather than client-side redirect could be useful for certain apps to avoid the round-trip / GET restricted urls. Thanks for the great library.


    • #3
      Hi Jim, urlPath is just a static convenience method on SiteSwitcherHandlerInterceptor. You can construct one with custom SiteUrlFactory implementations for more fine grained control. But it sounds like you reviewed the internals of how it works already. You may also want to look at LiteDeviceDelegatingViewResolver, which redirects internally to different views instead of rewriting urls. Currently, it's the only place we support suffixes. Would you mind creating a JIRA for the suffix support in urlPath? Thanks for the interest in the project!