I'm building a website using Spring and the SpringMobile extension.
I've configured the LiteDeviceDelegatingViewResolver
with mobilePrefix = m/
, tabletPrefix = t/
and enableFallback = true
, so that, whenever a dedicated mobile (or tablet) view isn't available, the "normal" (desktop site) view is served.
The site has several sections and subsections. For instance, there's a Products section and several Categories within it.
Currently, there isn't a landing page for Products, so I redirect the user to the first Category. In other words, when the link to /products
is clicked, the corresponding @Controller
method redirects to /products/category1
(by returning "redirect:/products/category1"
); then, the method mapped to /products/category1
, serves the view (by returning "viewname"
).
This works as expected when using the desktop site. However, in the mobile site, whenever I try to browse to /products
, I get automatically redirected to /m/products
by SpringMobile (which is fine), but then my @Controller
gets into action, and, instead of being eventually redirected to /m/products/category1
, strangely I get redirected to /m/products/m//products/category1
.
Any ideas on why is this happening, and on how to achieve the expected behavior?
P.S.: If I navigate directly to /m/products/category1
, the desktop view (the fallback) is properly shown.
Well, it turns out this was a bug in SpringMobile(MOBILE-70, MOBILE-78) which was fixed in version 1.1.0.RC1. It also affected forward:
redirection.
I've updated my project dependencies, and the issues appear to be gone for good.