Search in sources :

Example 6 with CharacterEncodingFilter

use of org.springframework.web.filter.CharacterEncodingFilter in project spring-boot by spring-projects.

the class HttpEncodingAutoConfigurationTests method forceRequest.

@Test
public void forceRequest() throws Exception {
    load(EmptyConfiguration.class, "spring.http.encoding.force-request:false");
    CharacterEncodingFilter filter = this.context.getBean(CharacterEncodingFilter.class);
    assertCharacterEncodingFilter(filter, "UTF-8", false, false);
}
Also used : CharacterEncodingFilter(org.springframework.web.filter.CharacterEncodingFilter) Test(org.junit.Test)

Example 7 with CharacterEncodingFilter

use of org.springframework.web.filter.CharacterEncodingFilter in project spring-boot by spring-projects.

the class HttpEncodingAutoConfigurationTests method customConfiguration.

@Test
public void customConfiguration() {
    load(EmptyConfiguration.class, "spring.http.encoding.charset:ISO-8859-15", "spring.http.encoding.force:false");
    CharacterEncodingFilter filter = this.context.getBean(CharacterEncodingFilter.class);
    assertCharacterEncodingFilter(filter, "ISO-8859-15", false, false);
}
Also used : CharacterEncodingFilter(org.springframework.web.filter.CharacterEncodingFilter) Test(org.junit.Test)

Example 8 with CharacterEncodingFilter

use of org.springframework.web.filter.CharacterEncodingFilter in project spring-boot by spring-projects.

the class HttpEncodingAutoConfigurationTests method defaultConfiguration.

@Test
public void defaultConfiguration() {
    load(EmptyConfiguration.class);
    CharacterEncodingFilter filter = this.context.getBean(CharacterEncodingFilter.class);
    assertCharacterEncodingFilter(filter, "UTF-8", true, false);
}
Also used : CharacterEncodingFilter(org.springframework.web.filter.CharacterEncodingFilter) Test(org.junit.Test)

Example 9 with CharacterEncodingFilter

use of org.springframework.web.filter.CharacterEncodingFilter in project spring-boot by spring-projects.

the class HttpEncodingAutoConfigurationTests method forceResponseOverridesForce.

@Test
public void forceResponseOverridesForce() throws Exception {
    load(EmptyConfiguration.class, "spring.http.encoding.force:true", "spring.http.encoding.force-response:false");
    CharacterEncodingFilter filter = this.context.getBean(CharacterEncodingFilter.class);
    assertCharacterEncodingFilter(filter, "UTF-8", true, false);
}
Also used : CharacterEncodingFilter(org.springframework.web.filter.CharacterEncodingFilter) Test(org.junit.Test)

Example 10 with CharacterEncodingFilter

use of org.springframework.web.filter.CharacterEncodingFilter in project spring-boot by spring-projects.

the class HttpEncodingAutoConfigurationTests method forceResponse.

@Test
public void forceResponse() throws Exception {
    load(EmptyConfiguration.class, "spring.http.encoding.force-response:true");
    CharacterEncodingFilter filter = this.context.getBean(CharacterEncodingFilter.class);
    assertCharacterEncodingFilter(filter, "UTF-8", true, true);
}
Also used : CharacterEncodingFilter(org.springframework.web.filter.CharacterEncodingFilter) Test(org.junit.Test)

Aggregations

CharacterEncodingFilter (org.springframework.web.filter.CharacterEncodingFilter)11 Test (org.junit.Test)7 Bean (org.springframework.context.annotation.Bean)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 Before (org.junit.Before)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)1 OrderedCharacterEncodingFilter (org.springframework.boot.web.servlet.filter.OrderedCharacterEncodingFilter)1 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)1 Order (org.springframework.core.annotation.Order)1 ShallowEtagHeaderFilter (org.springframework.web.filter.ShallowEtagHeaderFilter)1