Package org.springframework.web.filter

Examples of org.springframework.web.filter.CharacterEncodingFilter


            throw new IllegalStateException("'ServicesDispatcher' could not be mapped to '" + SERVICES_MAPPING + "'");
        }
    }

    private void addEncodingFilter(ServletContext container) {
        FilterRegistration.Dynamic fr = container.addFilter("encodingFilter", new CharacterEncodingFilter());
        fr.setInitParameter("encoding", "UTF-8");
        fr.setInitParameter("forceEncoding", "true");
        fr.addMappingForUrlPatterns(null, true, "/*");
    }
View Full Code Here


        }
    }

    @Bean
    public Filter characterEncodingFilter() {
        CharacterEncodingFilter filter = new CharacterEncodingFilter();
        filter.setEncoding("UTF-8");
        filter.setForceEncoding(true);
        return filter;
    }
View Full Code Here

        return new Class<?>[] {WebMvcConfig.class};
    }

    @Override
    protected Filter[] getServletFilters() {
        CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
        characterEncodingFilter.setEncoding("UTF-8");
        characterEncodingFilter.setForceEncoding(true);

        DelegatingFilterProxy securityFilterChain = new DelegatingFilterProxy("springSecurityFilterChain");

        return new Filter[] {characterEncodingFilter, securityFilterChain};
    }
View Full Code Here

        return new Class<?>[] {WebMvcConfig.class};
    }

    @Override
    protected Filter[] getServletFilters() {
        CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
        characterEncodingFilter.setEncoding("UTF-8");
        characterEncodingFilter.setForceEncoding(true);
        return new Filter[] {characterEncodingFilter};
    }
View Full Code Here

    @Test
    public void chainMultiple() {
        MockMvcBuilders
                .webAppContextSetup(wac)
                .addFilter(new CharacterEncodingFilter() )
                .defaultRequest(get("/").contextPath("/mywebapp"))
                .build();
    }
View Full Code Here

        dispatcher.setLoadOnStartup(1);
        dispatcher.addMapping(DISPATCHER_SERVLET_MAPPING);

        EnumSet<DispatcherType> dispatcherTypes = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD);

        CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
        characterEncodingFilter.setEncoding("UTF-8");
        characterEncodingFilter.setForceEncoding(true);

        FilterRegistration.Dynamic characterEncoding = servletContext.addFilter("characterEncoding", characterEncodingFilter);
        characterEncoding.addMappingForUrlPatterns(dispatcherTypes, true, "/*");

        FilterRegistration.Dynamic security = servletContext.addFilter("springSecurityFilterChain", new DelegatingFilterProxy());
View Full Code Here

  @Bean
  @Order(Ordered.HIGHEST_PRECEDENCE)
  @ConditionalOnMissingBean
  public CharacterEncodingFilter characterEncodingFilter() {
    CharacterEncodingFilter filter = new CharacterEncodingFilter();
    filter.setEncoding(this.httpEncodingProperties.getCharset().name());
    filter.setForceEncoding(this.httpEncodingProperties.isForce());
    return filter;
  }
View Full Code Here

  }

  @Test
  public void defaultConfiguration() {
    load(EmptyConfiguration.class);
    CharacterEncodingFilter filter = this.context
        .getBean(CharacterEncodingFilter.class);
    assertCharacterEncodingFilter(filter, "UTF-8", true);
  }
View Full Code Here

  @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);
  }
View Full Code Here

  @Test
  public void customFilterConfiguration() {
    load(FilterConfiguration.class, "spring.http.encoding.charset:ISO-8859-15",
        "spring.http.encoding.force:false");
    CharacterEncodingFilter filter = this.context
        .getBean(CharacterEncodingFilter.class);
    assertCharacterEncodingFilter(filter, "US-ASCII", false);
  }
View Full Code Here

TOP

Related Classes of org.springframework.web.filter.CharacterEncodingFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.