Rename charSet to charset

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

Fixes gh-1835
pull/1840/merge
Phillip Webb 10 years ago
parent ab7f73f365
commit ba0dd60de9

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

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

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

Loading…
Cancel
Save