One problem that I had when using LiteDeviceDelegatingViewResolver is that it does not allow to switch layout according to device when delegating to a VelocityLayoutViewResolver.
I wanted that only the DeviceDelegatingViewResolver to be aware of the device, and I also don't want the fallback layout to be a mobile or tablet layout.
So I wrote my own delegatingViewResolver DeviceDelegatingLayoutVelocityViewResolver for this purpose. And I thought that some of you might be interested.
One possible configuration would be :
Code:<bean class="com.sfr.businessroom.view.DeviceDelegatingLayoutVelocityViewResolver"> <constructor-arg> <bean class="org.springframework.web.servlet.view.velocity.VelocityLayoutViewResolver"> <property name="contentType" value="text/html;charset=UTF-8" /> <!-- This layout will be used if no layout for the current device is found, or in case of fallback--> <property name="layoutUrl" value="/layout.vm" /> <property name="suffix" value=".vm" /> <property name="viewNames"> <array> <value>front/*</value> <value>mobile/front/*</value> <value>tablet/front/*</value> </array> </property> </bean> </constructor-arg> <property name="enableFallback" value="true"/> <property name="mobilePrefix" value="mobile/" /> <property name="tabletPrefix" value="tablet/" /> <property name="normalPrefix" value="front/" /> <property name="mobileLayoutUrl" value="/mobile_layout.vm"/> <property name="tableLayoutUrl" value="/tablet_layout.vm"/> </bean>
I would like to have your feedbacks on this. Also if you have an idea of another name for it :-/. Also I have difficulties to test it (the LiteDeviceDelegatingViewResolverTest does not adapt easily to this).