I was wondering if someone has already solved this. I have a SpringMVC app and we are adding support to WebKit type mobiles (iPhone and Android basically) so I was wondering someone has found an elegant way of defining specific views depending on the client that sent the request.
I know that a simple if in a Controller implementation can do the trick, but I'm looking for something more flexible/elegant (a specific ViewResolver implementation, or an interceptor maybe).
Help will be greatly appreciated... as always =)
This is a pretty old question. What you need to do is use Spring-Mobile to achieve this in a standard elegant manner
Обновление: посмотрите на spring-mobile
Исходный ответ:
Было бы довольно просто создать собственный ViewResolver
, который разрешает представления на основе User-Agent. Заголовок
.
null
, что позволит другим преобразователям разрешать представление.