use of org.springframework.mobile.device.view.LiteDeviceDelegatingViewResolver in project spring-boot by spring-projects.
the class DeviceDelegatingViewResolverAutoConfigurationTests method getLiteDeviceDelegatingViewResolverAccessor.
private PropertyAccessor getLiteDeviceDelegatingViewResolverAccessor(String... configuration) {
load(configuration);
LiteDeviceDelegatingViewResolver liteDeviceDelegatingViewResolver = this.context.getBean("deviceDelegatingJspViewResolver", LiteDeviceDelegatingViewResolver.class);
return new DirectFieldAccessor(liteDeviceDelegatingViewResolver);
}
use of org.springframework.mobile.device.view.LiteDeviceDelegatingViewResolver in project spring-boot by spring-projects.
the class DeviceDelegatingViewResolverAutoConfigurationTests method assertLiteDeviceDelegatingViewResolver.
public void assertLiteDeviceDelegatingViewResolver(ViewResolver delegate, String delegatingBeanName) {
LiteDeviceDelegatingViewResolver deviceDelegatingViewResolver = this.context.getBean(delegatingBeanName, LiteDeviceDelegatingViewResolver.class);
assertThat(deviceDelegatingViewResolver.getViewResolver()).isSameAs(delegate);
assertThat(deviceDelegatingViewResolver.getOrder()).isEqualTo(((Ordered) delegate).getOrder() - 1);
}
use of org.springframework.mobile.device.view.LiteDeviceDelegatingViewResolver in project spring-boot by spring-projects.
the class DeviceDelegatingViewResolverAutoConfigurationTests method defaultPropertyValues.
@Test
public void defaultPropertyValues() throws Exception {
load("spring.mobile.devicedelegatingviewresolver.enabled:true");
LiteDeviceDelegatingViewResolver liteDeviceDelegatingViewResolver = this.context.getBean("deviceDelegatingJspViewResolver", LiteDeviceDelegatingViewResolver.class);
DirectFieldAccessor accessor = new DirectFieldAccessor(liteDeviceDelegatingViewResolver);
assertThat(accessor.getPropertyValue("enableFallback")).isEqualTo(Boolean.FALSE);
assertThat(accessor.getPropertyValue("normalPrefix")).isEqualTo("");
assertThat(accessor.getPropertyValue("mobilePrefix")).isEqualTo("mobile/");
assertThat(accessor.getPropertyValue("tabletPrefix")).isEqualTo("tablet/");
assertThat(accessor.getPropertyValue("normalSuffix")).isEqualTo("");
assertThat(accessor.getPropertyValue("mobileSuffix")).isEqualTo("");
assertThat(accessor.getPropertyValue("tabletSuffix")).isEqualTo("");
}
use of org.springframework.mobile.device.view.LiteDeviceDelegatingViewResolver in project spring-boot by spring-projects.
the class DeviceDelegatingViewResolverFactory method createViewResolver.
/**
* Create a {@link LiteDeviceDelegatingViewResolver} delegating to the specified
* {@link ViewResolver}.
* @param delegate the view resolver to delegate to
* @param delegatingOrder the order of the {@link LiteDeviceDelegatingViewResolver}
* @return a {@link LiteDeviceDelegatingViewResolver} handling the specified resolver
*/
public LiteDeviceDelegatingViewResolver createViewResolver(ViewResolver delegate, int delegatingOrder) {
LiteDeviceDelegatingViewResolver resolver = new LiteDeviceDelegatingViewResolver(delegate);
resolver.setEnableFallback(this.properties.isEnableFallback());
resolver.setNormalPrefix(this.properties.getNormalPrefix());
resolver.setNormalSuffix(this.properties.getNormalSuffix());
resolver.setMobilePrefix(this.properties.getMobilePrefix());
resolver.setMobileSuffix(this.properties.getMobileSuffix());
resolver.setTabletPrefix(this.properties.getTabletPrefix());
resolver.setTabletSuffix(this.properties.getTabletSuffix());
resolver.setOrder(delegatingOrder);
return resolver;
}
Aggregations