| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.config;
|
1 |
package com.spice.profitmandi.web.config;
|
| 2 |
|
2 |
|
| - |
|
3 |
import javax.servlet.FilterRegistration;
|
| 3 |
import javax.servlet.ServletContext;
|
4 |
import javax.servlet.ServletContext;
|
| 4 |
import javax.servlet.ServletException;
|
5 |
import javax.servlet.ServletException;
|
| 5 |
import javax.servlet.ServletRegistration;
|
6 |
import javax.servlet.ServletRegistration;
|
| 6 |
|
7 |
|
| 7 |
import org.apache.logging.log4j.LogManager;
|
8 |
import org.apache.logging.log4j.LogManager;
|
| Line 11... |
Line 12... |
| 11 |
import org.springframework.web.WebApplicationInitializer;
|
12 |
import org.springframework.web.WebApplicationInitializer;
|
| 12 |
import org.springframework.web.context.ContextLoaderListener;
|
13 |
import org.springframework.web.context.ContextLoaderListener;
|
| 13 |
import org.springframework.web.context.WebApplicationContext;
|
14 |
import org.springframework.web.context.WebApplicationContext;
|
| 14 |
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
|
15 |
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
|
| 15 |
import org.springframework.web.servlet.DispatcherServlet;
|
16 |
import org.springframework.web.servlet.DispatcherServlet;
|
| - |
|
17 |
import com.spice.profitmandi.web.filter.RequestCachingFilter;
|
| 16 |
|
18 |
|
| 17 |
public class SpringWebAppInitializer implements WebApplicationInitializer{
|
19 |
public class SpringWebAppInitializer implements WebApplicationInitializer{
|
| 18 |
|
20 |
|
| 19 |
private static final Logger LOGGER = LogManager.getLogger(SpringWebAppInitializer.class);
|
21 |
private static final Logger LOGGER = LogManager.getLogger(SpringWebAppInitializer.class);
|
| 20 |
|
22 |
|
| Line 28... |
Line 30... |
| 28 |
applicationContext = context;
|
30 |
applicationContext = context;
|
| 29 |
servletContext.addListener(new ContextLoaderListener(context));
|
31 |
servletContext.addListener(new ContextLoaderListener(context));
|
| 30 |
ServletRegistration.Dynamic dispatcher = servletContext.addServlet(DISPATCHER_SERVLET_NAME, new DispatcherServlet(context));
|
32 |
ServletRegistration.Dynamic dispatcher = servletContext.addServlet(DISPATCHER_SERVLET_NAME, new DispatcherServlet(context));
|
| 31 |
dispatcher.setLoadOnStartup(1);
|
33 |
dispatcher.setLoadOnStartup(1);
|
| 32 |
dispatcher.addMapping("/");
|
34 |
dispatcher.addMapping("/");
|
| - |
|
35 |
|
| - |
|
36 |
FilterRegistration.Dynamic cachingFilter = servletContext.addFilter("requestCachingFilter", new RequestCachingFilter());
|
| - |
|
37 |
cachingFilter.addMappingForServletNames(null, false, DISPATCHER_SERVLET_NAME);
|
| - |
|
38 |
|
| 33 |
LOGGER.info("Context is loaded");
|
39 |
LOGGER.info("Context is loaded");
|
| 34 |
}
|
40 |
}
|
| 35 |
|
41 |
|
| 36 |
private AnnotationConfigWebApplicationContext getContext() {
|
42 |
private AnnotationConfigWebApplicationContext getContext() {
|
| 37 |
AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
|
43 |
AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
|