Commit bd6f7a58 authored by Stephane Nicoll's avatar Stephane Nicoll

Expose enableFallback property

Add an extra property to control the support of fallback resolution for
mobile views.

Fixes gh-3009, gh-3019
parent 597e1c3c
/* /*
* Copyright 2012-2014 the original author or authors. * Copyright 2012-2015 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -64,6 +64,7 @@ public class DeviceDelegatingViewResolverAutoConfiguration { ...@@ -64,6 +64,7 @@ public class DeviceDelegatingViewResolverAutoConfiguration {
ViewResolver delegate, int delegateOrder) { ViewResolver delegate, int delegateOrder) {
LiteDeviceDelegatingViewResolver resolver = new LiteDeviceDelegatingViewResolver( LiteDeviceDelegatingViewResolver resolver = new LiteDeviceDelegatingViewResolver(
delegate); delegate);
resolver.setEnableFallback(this.viewResolverProperties.isEnableFallback());
resolver.setNormalPrefix(this.viewResolverProperties.getNormalPrefix()); resolver.setNormalPrefix(this.viewResolverProperties.getNormalPrefix());
resolver.setNormalSuffix(this.viewResolverProperties.getNormalSuffix()); resolver.setNormalSuffix(this.viewResolverProperties.getNormalSuffix());
resolver.setMobilePrefix(this.viewResolverProperties.getMobilePrefix()); resolver.setMobilePrefix(this.viewResolverProperties.getMobilePrefix());
......
/* /*
* Copyright 2012-2014 the original author or authors. * Copyright 2012-2015 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -27,6 +27,11 @@ import org.springframework.boot.context.properties.ConfigurationProperties; ...@@ -27,6 +27,11 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties("spring.mobile.devicedelegatingviewresolver") @ConfigurationProperties("spring.mobile.devicedelegatingviewresolver")
public class DeviceDelegatingViewResolverProperties { public class DeviceDelegatingViewResolverProperties {
/**
* Enable support for fallback resolution.
*/
private boolean enableFallback;
/** /**
* Prefix that gets prepended to view names for normal devices. * Prefix that gets prepended to view names for normal devices.
*/ */
...@@ -57,6 +62,14 @@ public class DeviceDelegatingViewResolverProperties { ...@@ -57,6 +62,14 @@ public class DeviceDelegatingViewResolverProperties {
*/ */
private String tabletSuffix = ""; private String tabletSuffix = "";
public void setEnableFallback(boolean enableFallback) {
this.enableFallback = enableFallback;
}
public boolean isEnableFallback() {
return enableFallback;
}
public String getNormalPrefix() { public String getNormalPrefix() {
return this.normalPrefix; return this.normalPrefix;
} }
......
...@@ -497,6 +497,7 @@ content into your application; rather pick only the properties that you need. ...@@ -497,6 +497,7 @@ content into your application; rather pick only the properties that you need.
# SPRING MOBILE DEVICE VIEWS ({sc-spring-boot-autoconfigure}/mobile/DeviceDelegatingViewResolverAutoConfiguration.{sc-ext}[DeviceDelegatingViewResolverAutoConfiguration]) # SPRING MOBILE DEVICE VIEWS ({sc-spring-boot-autoconfigure}/mobile/DeviceDelegatingViewResolverAutoConfiguration.{sc-ext}[DeviceDelegatingViewResolverAutoConfiguration])
spring.mobile.devicedelegatingviewresolver.enabled=true # disabled by default spring.mobile.devicedelegatingviewresolver.enabled=true # disabled by default
spring.mobile.devicedelegatingviewresolver.enable-fallback= # enable support for fallback resolution, default to false.
spring.mobile.devicedelegatingviewresolver.normal-prefix= spring.mobile.devicedelegatingviewresolver.normal-prefix=
spring.mobile.devicedelegatingviewresolver.normal-suffix= spring.mobile.devicedelegatingviewresolver.normal-suffix=
spring.mobile.devicedelegatingviewresolver.mobile-prefix=mobile/ spring.mobile.devicedelegatingviewresolver.mobile-prefix=mobile/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment