Browse Source

Polish naming for Charset setters in FreeMarker support

See gh-33102
pull/33105/head
Sam Brannen 1 year ago
parent
commit
95887c81b9
  1. 10
      spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerConfigurationFactory.java
  2. 2
      spring-webflux/src/main/java/org/springframework/web/reactive/result/view/freemarker/FreeMarkerConfigurer.java
  3. 10
      spring-webflux/src/main/java/org/springframework/web/reactive/result/view/freemarker/FreeMarkerView.java
  4. 4
      spring-webflux/src/test/java/org/springframework/web/reactive/config/WebFluxViewResolutionIntegrationTests.java
  5. 10
      spring-webmvc/src/main/java/org/springframework/web/servlet/view/freemarker/FreeMarkerView.java
  6. 4
      spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/ViewResolutionIntegrationTests.java

10
spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerConfigurationFactory.java

@ -158,15 +158,15 @@ public class FreeMarkerConfigurationFactory { @@ -158,15 +158,15 @@ public class FreeMarkerConfigurationFactory {
}
/**
* Set the default encoding for the FreeMarker {@link Configuration}, which
* is used to decode byte sequences to character sequences when reading template
* files.
* Set the {@link Charset} for the default encoding for the FreeMarker
* {@link Configuration}, which is used to decode byte sequences to character
* sequences when reading template files.
* <p>See {@link #setDefaultEncoding(String)} for details.
* @since 6.2
* @see java.nio.charset.StandardCharsets
*/
public void setDefaultEncoding(Charset defaultEncoding) {
setDefaultEncoding(defaultEncoding.name());
public void setDefaultCharset(Charset defaultCharset) {
this.defaultEncoding = defaultCharset.name();
}
/**

2
spring-webflux/src/main/java/org/springframework/web/reactive/result/view/freemarker/FreeMarkerConfigurer.java

@ -69,7 +69,7 @@ public class FreeMarkerConfigurer extends FreeMarkerConfigurationFactory @@ -69,7 +69,7 @@ public class FreeMarkerConfigurer extends FreeMarkerConfigurationFactory
public FreeMarkerConfigurer() {
setDefaultEncoding(StandardCharsets.UTF_8);
setDefaultCharset(StandardCharsets.UTF_8);
}

10
spring-webflux/src/main/java/org/springframework/web/reactive/result/view/freemarker/FreeMarkerView.java

@ -167,7 +167,7 @@ public class FreeMarkerView extends AbstractUrlBasedView { @@ -167,7 +167,7 @@ public class FreeMarkerView extends AbstractUrlBasedView {
* process. See the note in the {@linkplain FreeMarkerView class-level
* documentation} for details.
* @see freemarker.template.Configuration#setDefaultEncoding
* @see #setEncoding(Charset)
* @see #setCharset(Charset)
* @see #getEncoding()
*/
public void setEncoding(@Nullable String encoding) {
@ -175,14 +175,14 @@ public class FreeMarkerView extends AbstractUrlBasedView { @@ -175,14 +175,14 @@ public class FreeMarkerView extends AbstractUrlBasedView {
}
/**
* Set the encoding used to decode byte sequences to character sequences when
* reading the FreeMarker template file for this view.
* Set the {@link Charset} used to decode byte sequences to character sequences
* when reading the FreeMarker template file for this view.
* <p>See {@link #setEncoding(String)} for details.
* @since 6.2
* @see java.nio.charset.StandardCharsets
*/
public void setEncoding(@Nullable Charset encoding) {
setEncoding(encoding != null ? encoding.name() : null);
public void setCharset(@Nullable Charset charset) {
this.encoding = (charset != null ? charset.name() : null);
}
/**

4
spring-webflux/src/test/java/org/springframework/web/reactive/config/WebFluxViewResolutionIntegrationTests.java

@ -135,7 +135,7 @@ class WebFluxViewResolutionIntegrationTests { @@ -135,7 +135,7 @@ class WebFluxViewResolutionIntegrationTests {
public FreeMarkerConfigurer freeMarkerConfigurer() {
FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
configurer.setPreTemplateLoaders(classTemplateLoader);
configurer.setDefaultEncoding(UTF_8);
configurer.setDefaultCharset(UTF_8);
return configurer;
}
}
@ -158,7 +158,7 @@ class WebFluxViewResolutionIntegrationTests { @@ -158,7 +158,7 @@ class WebFluxViewResolutionIntegrationTests {
public FreeMarkerConfigurer freeMarkerConfigurer() {
FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
configurer.setPreTemplateLoaders(classTemplateLoader);
configurer.setDefaultEncoding(ISO_8859_1);
configurer.setDefaultCharset(ISO_8859_1);
return configurer;
}

10
spring-webmvc/src/main/java/org/springframework/web/servlet/view/freemarker/FreeMarkerView.java

@ -116,7 +116,7 @@ public class FreeMarkerView extends AbstractTemplateView { @@ -116,7 +116,7 @@ public class FreeMarkerView extends AbstractTemplateView {
* process. See the note in the {@linkplain FreeMarkerView class-level
* documentation} for details.
* @see freemarker.template.Configuration#setDefaultEncoding
* @see #setEncoding(Charset)
* @see #setCharset(Charset)
* @see #getEncoding()
* @see #setContentType(String)
*/
@ -125,14 +125,14 @@ public class FreeMarkerView extends AbstractTemplateView { @@ -125,14 +125,14 @@ public class FreeMarkerView extends AbstractTemplateView {
}
/**
* Set the encoding used to decode byte sequences to character sequences when
* reading the FreeMarker template file for this view.
* Set the {@link Charset} used to decode byte sequences to character sequences
* when reading the FreeMarker template file for this view.
* <p>See {@link #setEncoding(String)} for details.
* @since 6.2
* @see java.nio.charset.StandardCharsets
*/
public void setEncoding(@Nullable Charset encoding) {
setEncoding(encoding != null ? encoding.name() : null);
public void setCharset(@Nullable Charset charset) {
this.encoding = (charset != null ? charset.name() : null);
}
/**

4
spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/ViewResolutionIntegrationTests.java

@ -164,7 +164,7 @@ class ViewResolutionIntegrationTests { @@ -164,7 +164,7 @@ class ViewResolutionIntegrationTests {
public FreeMarkerConfigurer freeMarkerConfigurer() {
FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
configurer.setTemplateLoaderPath("/WEB-INF/");
configurer.setDefaultEncoding(UTF_8);
configurer.setDefaultCharset(UTF_8);
return configurer;
}
}
@ -183,7 +183,7 @@ class ViewResolutionIntegrationTests { @@ -183,7 +183,7 @@ class ViewResolutionIntegrationTests {
public FreeMarkerConfigurer freeMarkerConfigurer() {
FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
configurer.setTemplateLoaderPath("/WEB-INF/");
configurer.setDefaultEncoding(UTF_8);
configurer.setDefaultCharset(UTF_8);
return configurer;
}
}

Loading…
Cancel
Save