package ch.itraum.recruiter.config;

import java.io.File;

import javax.servlet.MultipartConfigElement;
import javax.servlet.ServletRegistration;

import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
	
	private int maxUploadSizeInMb = 5 * 1024 * 1024; // 5 MB

	@Override
	protected Class<?>[] getRootConfigClasses() {
		return new Class[] { ApplicationConfig.class };
	}

	@Override
	protected Class<?>[] getServletConfigClasses() {
		return new Class[] { WebConfig.class };
	}

	@Override
	protected String[] getServletMappings() {
		return new String[] { "/" };
	}
	
	@Override
    protected void customizeRegistration(ServletRegistration.Dynamic registration) {

        File uploadDirectory = new File("/tmp");

        MultipartConfigElement multipartConfigElement = 
            new MultipartConfigElement(uploadDirectory.getAbsolutePath(),
                maxUploadSizeInMb, maxUploadSizeInMb * 2, maxUploadSizeInMb / 2);

        registration.setMultipartConfig(multipartConfigElement);

    }
}

@@ -52,16 +52,45 @@
 .File;%0A%0A
+import javax.servlet.Filter;%0A
 import j
@@ -169,16 +169,79 @@
 ation;%0A%0A
+import org.springframework.web.filter.CharacterEncodingFilter;%0A
 import o
@@ -1231,10 +1231,306 @@
 %0A%0A    %7D%0A
+%09%0A%09@Override%0A%09protected Filter%5B%5D getServletFilters() %7B%0A%09%09%0A%09%09CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();%0A%09%09characterEncodingFilter.setEncoding(%22UTF-8%22);%0A%09%09characterEncodingFilter.setForceEncoding(true);%0A%09%09%0A%09%09return new Filter%5B%5D %7B characterEncodingFilter %7D;%0A%09%7D%0A
 %7D%0A

Add CharacterEncodingFilter