Rename charSet to charset

Rename AbstractTemplateViewResolverProperties.setCharSet/getCharSet to
setCharset/getCharset, deprecating the old method.

Fixes gh-1835
This commit is contained in:
Phillip Webb 2014-11-05 16:57:05 -08:00
parent ab7f73f365
commit ba0dd60de9
3 changed files with 24 additions and 8 deletions

View File

@ -91,7 +91,7 @@ public class FreeMarkerAutoConfiguration {
protected void applyProperties(FreeMarkerConfigurationFactory factory) {
factory.setTemplateLoaderPaths(this.properties.getTemplateLoaderPath());
factory.setDefaultEncoding(this.properties.getCharSet());
factory.setDefaultEncoding(this.properties.getCharset());
Properties settings = new Properties();
settings.putAll(this.properties.getSettings());
factory.setFreemarkerSettings(settings);

View File

@ -38,7 +38,7 @@ public abstract class AbstractTemplateViewResolverProperties {
private String contentType = "text/html";
private String charSet = "UTF-8";
private String charset = "UTF-8";
private String[] viewNames;
@ -87,19 +87,35 @@ public abstract class AbstractTemplateViewResolverProperties {
public String getContentType() {
return this.contentType
+ (this.contentType.contains(";charset=") ? "" : ";charset="
+ this.charSet);
+ this.charset);
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
/**
* @deprecated since 1.2.0 in favor of {@link #getCharset()}
*/
@Deprecated
public String getCharSet() {
return this.charSet;
return getCharset();
}
/**
* @deprecated since 1.2.0 in favor of {@link #setCharset(String)}
*/
@Deprecated
public void setCharSet(String charSet) {
this.charSet = charSet;
setCharset(charSet);
}
public String getCharset() {
return this.charset;
}
public void setCharset(String charset) {
this.charset = charset;
}
public String getPrefix() {

View File

@ -115,7 +115,7 @@ content into your application; rather pick only the properties that you need.
spring.freemarker.allow-request-override=false
spring.freemarker.cache=true
spring.freemarker.check-template-location=true
spring.freemarker.char-set=UTF-8
spring.freemarker.charset=UTF-8
spring.freemarker.contentType=text/html
spring.freemarker.exposeRequestAttributes=false
spring.freemarker.exposeSessionAttributes=false
@ -129,7 +129,7 @@ content into your application; rather pick only the properties that you need.
# GROOVY TEMPLATES ({sc-spring-boot-autoconfigure}/groovy/template/GroovyTemplateAutoConfiguration.{sc-ext}[GroovyTemplateAutoConfiguration])
spring.groovy.template.cache=true
spring.groovy.template.char-set=UTF-8
spring.groovy.template.charset=UTF-8
spring.groovy.template.configuration.*= # See Groovy's TemplateConfiguration
spring.groovy.template.contentType=text/html
spring.groovy.template.prefix=classpath:/templates/
@ -140,7 +140,7 @@ content into your application; rather pick only the properties that you need.
spring.velocity.allow-request-override=false
spring.velocity.cache=true
spring.velocity.check-template-location=true
spring.velocity.char-set=UTF-8
spring.velocity.charset=UTF-8
spring.velocity.content-type=text/html
spring.velocity.date-tool-attribute=
spring.velocity.expose-Request-attributes=false