Example usage for org.springframework.web.filter CharacterEncodingFilter CharacterEncodingFilter

List of usage examples for org.springframework.web.filter CharacterEncodingFilter CharacterEncodingFilter

Introduction

In this page you can find the example usage for org.springframework.web.filter CharacterEncodingFilter CharacterEncodingFilter.

Prototype

public CharacterEncodingFilter(String encoding, boolean forceEncoding) 

Source Link

Document

Create a CharacterEncodingFilter for the given encoding.

Usage

From source file:org.fede.calculator.web.MvcWebApplicationInitializer.java

@Override
protected Filter[] getServletFilters() {
    return new Filter[] { new CharacterEncodingFilter("UTF-8", true) };
}

From source file:com.jim.im.config.GenericJerseyConfig.java

@Bean
CharacterEncodingFilter characterEncodingFilter() {
    return new CharacterEncodingFilter("UTF8", true);
}

From source file:org.homiefund.init.WebAppBoostrapper.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
    rootContext.register(ApplicationConfiguration.class, SecurityConfiguration.class);

    servletContext.addListener(new ContextLoaderListener(rootContext));
    servletContext.addListener(new RequestContextListener());

    AnnotationConfigWebApplicationContext dispatcherContext = new AnnotationConfigWebApplicationContext();
    dispatcherContext.register(MvcConfiguration.class);

    ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher",
            new DispatcherServlet(dispatcherContext));
    dispatcher.setLoadOnStartup(1);/* w  w w .  ja  v a2 s.  c  o  m*/
    dispatcher.setAsyncSupported(true);
    dispatcher.addMapping("/");

    servletContext.addFilter("encodingFilter", new CharacterEncodingFilter("UTF-8", true))
            .addMappingForUrlPatterns(null, false, "/*");

    servletContext.addFilter("httpMethodFilter", new HiddenHttpMethodFilter()).addMappingForUrlPatterns(null,
            true, "/*");
}

From source file:cz.muni.fi.editor.webapp.config.init.EditorApplicationInitializer.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    String bootLogo = "  __  __      _            _       _                   _ _ _             \n"
            + " |  \\/  |    | |          | |     | |                 | (_) |            \n"
            + " | \\  / | ___| |_ __ _  __| | __ _| |_ __ _    ___  __| |_| |_ ___  _ __ \n"
            + " | |\\/| |/ _ \\ __/ _` |/ _` |/ _` | __/ _` |  / _ \\/ _` | | __/ _ \\| '__|\n"
            + " | |  | |  __/ || (_| | (_| | (_| | || (_| | |  __/ (_| | | || (_) | |   \n"
            + " |_|  |_|\\___|\\__\\__,_|\\__,_|\\__,_|\\__\\__,_|  \\___|\\__,_|_|\\__\\___/|_|   \n"
            + "                                                                         \n"
            + "                                                                         ";

    System.out.println(ANSI_YELLOW + bootLogo + ANSI_RESET);

    AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
    rootContext.getEnvironment().setActiveProfiles("production");
    rootContext.register(WebAppConfiguration.class, SecurityConfig.class);

    servletContext.addListener(new ContextLoaderListener(rootContext));

    AnnotationConfigWebApplicationContext dispatcherContext = new AnnotationConfigWebApplicationContext();
    dispatcherContext.register(MvcConfiguration.class, WebSocketSecurityConfiguration.class);

    ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher",
            new DispatcherServlet(dispatcherContext));
    dispatcher.setLoadOnStartup(1);// w ww  .ja  v  a 2  s .com
    dispatcher.setAsyncSupported(true);
    dispatcher.addMapping("/");

    servletContext.addFilter("encodingFilter", new CharacterEncodingFilter("UTF-8", true))
            .addMappingForUrlPatterns(null, false, "/*");

    servletContext.addFilter("httpMethodFilter", new HiddenHttpMethodFilter()).addMappingForUrlPatterns(null,
            true, "/*");

}

From source file:org.openwms.tms.DocumentationBase.java

/**
 * Do something before each test method.
 *
 * @throws Exception Any error/*from   w  w  w  .j  a v a 2  s .  c o m*/
 */
@Before
public void setUp() throws Exception {
    INIT_LOC = new Location(INIT_LOC_STRING);
    ERR_LOC = new Location(ERR_LOC_STRING);
    INIT_LOCGRB = new LocationGroup(INIT_LOCGB_STRING);
    ERR_LOCGRB = new LocationGroup(ERR_LOCGB_STRING);
    mockMvc = MockMvcBuilders.webAppContextSetup(context)
            .apply(MockMvcRestDocumentation.documentationConfiguration(restDocumentation).uris().withPort(8888))
            .addFilters(new CharacterEncodingFilter("UTF-8", true)).build();
}