Search in sources :

Example 1 with HttpRequestHandlerServlet

use of org.springframework.web.context.support.HttpRequestHandlerServlet in project PublicCMS-preview by sanluan.

the class ResourceInitializer method onStartup.

public void onStartup(ServletContext servletContext) throws ServletException {
    Dynamic registration = servletContext.addServlet("defaultServlet", new HttpRequestHandlerServlet());
    registration.setLoadOnStartup(1);
    registration.addMapping(new String[] { "/resource/*", "/favicon.ico" });
    Dynamic webfileRegistration = servletContext.addServlet("webfileServlet", new HttpRequestHandlerServlet());
    webfileRegistration.setLoadOnStartup(0);
    webfileRegistration.addMapping(new String[] { "/webfile/*" });
    Filter[] filters = getServletFilters();
    if (!ObjectUtils.isEmpty(filters)) {
        for (Filter filter : filters) {
            registerServletFilter(servletContext, filter, new String[] { "defaultServlet", "webfileServlet" });
        }
    }
}
Also used : Dynamic(javax.servlet.ServletRegistration.Dynamic) CharacterEncodingFilter(org.springframework.web.filter.CharacterEncodingFilter) Filter(javax.servlet.Filter) HttpRequestHandlerServlet(org.springframework.web.context.support.HttpRequestHandlerServlet)

Aggregations

Filter (javax.servlet.Filter)1 Dynamic (javax.servlet.ServletRegistration.Dynamic)1 HttpRequestHandlerServlet (org.springframework.web.context.support.HttpRequestHandlerServlet)1 CharacterEncodingFilter (org.springframework.web.filter.CharacterEncodingFilter)1