Commit 7de64724 authored by Daniel Fernández's avatar Daniel Fernández Committed by Brian Clozel

Added configuration parameters at ThymeleafProperties for "fullModeViewNames"...

Added configuration parameters at ThymeleafProperties for "fullModeViewNames" and "chunkedModeViewNames"
parent ab8aa6bb
...@@ -264,6 +264,8 @@ public class ThymeleafAutoConfiguration { ...@@ -264,6 +264,8 @@ public class ThymeleafAutoConfiguration {
resolver.setResponseMaxChunkSizeBytes( resolver.setResponseMaxChunkSizeBytes(
this.properties.getReactive().getMaxChunkSize()); this.properties.getReactive().getMaxChunkSize());
} }
resolver.setFullModeViewNames(this.properties.getReactive().getFullModeViewNames());
resolver.setChunkedModeViewNames(this.properties.getReactive().getChunkedModeViewNames());
// This resolver acts as a fallback resolver (e.g. like a // This resolver acts as a fallback resolver (e.g. like a
// InternalResourceViewResolver) so it needs to have low precedence // InternalResourceViewResolver) so it needs to have low precedence
resolver.setOrder(Ordered.LOWEST_PRECEDENCE - 5); resolver.setOrder(Ordered.LOWEST_PRECEDENCE - 5);
......
...@@ -227,6 +227,19 @@ public class ThymeleafProperties { ...@@ -227,6 +227,19 @@ public class ThymeleafProperties {
*/ */
private List<MediaType> mediaTypes; private List<MediaType> mediaTypes;
/**
* Comma-separated list of view names (patterns allowed) that should be executed in FULL mode
* even if a max chunk size is set.
*/
private String[] fullModeViewNames;
/**
* Comma-separated list of view names (patterns allowed) that should be the only ones executed
* in CHUNKED mode when a max chunk size is set.
*/
private String[] chunkedModeViewNames;
public List<MediaType> getMediaTypes() { public List<MediaType> getMediaTypes() {
return this.mediaTypes; return this.mediaTypes;
} }
...@@ -243,6 +256,22 @@ public class ThymeleafProperties { ...@@ -243,6 +256,22 @@ public class ThymeleafProperties {
this.maxChunkSize = maxChunkSize; this.maxChunkSize = maxChunkSize;
} }
public String[] getFullModeViewNames() {
return this.fullModeViewNames;
}
public void setFullModeViewNames(String[] fullModeViewNames) {
this.fullModeViewNames = fullModeViewNames;
}
public String[] getChunkedModeViewNames() {
return this.chunkedModeViewNames;
}
public void setChunkedModeViewNames(String[] chunkedModeViewNames) {
this.chunkedModeViewNames = chunkedModeViewNames;
}
} }
} }
...@@ -112,6 +112,22 @@ public class ThymeleafReactiveAutoConfigurationTests { ...@@ -112,6 +112,22 @@ public class ThymeleafReactiveAutoConfigurationTests {
assertThat(views.getViewNames()).isEqualTo(new String[] { "foo", "bar" }); assertThat(views.getViewNames()).isEqualTo(new String[] { "foo", "bar" });
} }
@Test
public void overrideFullModeViewNames() throws Exception {
load(BaseConfiguration.class, "spring.thymeleaf.reactive.fullModeViewNames:foo,bar");
ThymeleafReactiveViewResolver views = this.context
.getBean(ThymeleafReactiveViewResolver.class);
assertThat(views.getFullModeViewNames()).isEqualTo(new String[] { "foo", "bar" });
}
@Test
public void overrideChunkedModeViewNames() throws Exception {
load(BaseConfiguration.class, "spring.thymeleaf.reactive.chunkedModeViewNames:foo,bar");
ThymeleafReactiveViewResolver views = this.context
.getBean(ThymeleafReactiveViewResolver.class);
assertThat(views.getChunkedModeViewNames()).isEqualTo(new String[] { "foo", "bar" });
}
@Test @Test
public void templateLocationDoesNotExist() throws Exception { public void templateLocationDoesNotExist() throws Exception {
load(BaseConfiguration.class, load(BaseConfiguration.class,
......
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