| Line 6... |
Line 6... |
| 6 |
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
6 |
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
| 7 |
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
7 |
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
| 8 |
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
8 |
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
| 9 |
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
9 |
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
| 10 |
|
10 |
|
| - |
|
11 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 11 |
import com.spice.profitmandi.web.interceptor.CreateApiRequestInterceptor;
|
12 |
import com.spice.profitmandi.web.interceptor.ApiRequestInterceptor;
|
| 12 |
import com.spice.profitmandi.web.model.ProfitMandiWebConstants;
|
13 |
import com.spice.profitmandi.web.interceptor.RoleRequestInterceptor;
|
| 13 |
|
14 |
|
| 14 |
@Configuration
|
15 |
@Configuration
|
| 15 |
@EnableWebMvc
|
16 |
@EnableWebMvc
|
| 16 |
@ComponentScan("com.spice.profitmandi.*")
|
17 |
@ComponentScan("com.spice.profitmandi.*")
|
| 17 |
public class WebMVCConfig extends WebMvcConfigurerAdapter{
|
18 |
public class WebMVCConfig extends WebMvcConfigurerAdapter{
|
| 18 |
|
19 |
|
| 19 |
private static final String RESOURCES_PATTERN="/resources/**";
|
20 |
private static final String RESOURCES_PATTERN="/resources/**";
|
| 20 |
private static final String RESOURCES_LOCATION="/resources/";
|
21 |
private static final String RESOURCES_LOCATION="/resources/";
|
| 21 |
|
22 |
|
| 22 |
@Autowired
|
23 |
@Autowired
|
| 23 |
CreateApiRequestInterceptor createApiRequestInterceptor;
|
24 |
ApiRequestInterceptor apiRequestInterceptor;
|
| - |
|
25 |
|
| - |
|
26 |
@Autowired
|
| - |
|
27 |
RoleRequestInterceptor roleRequestInterceptor;
|
| 24 |
|
28 |
|
| 25 |
@Override
|
29 |
@Override
|
| 26 |
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
30 |
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
| 27 |
registry.addResourceHandler(RESOURCES_PATTERN).addResourceLocations(RESOURCES_LOCATION);
|
31 |
registry.addResourceHandler(RESOURCES_PATTERN).addResourceLocations(RESOURCES_LOCATION);
|
| 28 |
}
|
32 |
}
|
| 29 |
|
33 |
|
| 30 |
@Override
|
34 |
@Override
|
| 31 |
public void addInterceptors(InterceptorRegistry registry) {
|
35 |
public void addInterceptors(InterceptorRegistry registry) {
|
| 32 |
registry.addInterceptor(createApiRequestInterceptor).addPathPatterns(ProfitMandiWebConstants.URL_API);
|
36 |
registry.addInterceptor(apiRequestInterceptor).addPathPatterns(ProfitMandiConstants.URL_API, ProfitMandiConstants.URL_API + "/");
|
| - |
|
37 |
registry.addInterceptor(roleRequestInterceptor).addPathPatterns(ProfitMandiConstants.URL_ROLE, ProfitMandiConstants.URL_ROLE + "/");
|
| 33 |
}
|
38 |
}
|
| 34 |
}
|
39 |
}
|
| 35 |
|
40 |
|