| Line 2... |
Line 2... |
| 2 |
|
2 |
|
| 3 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
3 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
| 4 |
import com.spice.profitmandi.web.interceptor.AuthenticationInterceptor;
|
4 |
import com.spice.profitmandi.web.interceptor.AuthenticationInterceptor;
|
| 5 |
import com.spice.profitmandi.web.interceptor.RoleInterceptor;
|
5 |
import com.spice.profitmandi.web.interceptor.RoleInterceptor;
|
| 6 |
import org.springframework.beans.factory.annotation.Autowired;
|
6 |
import org.springframework.beans.factory.annotation.Autowired;
|
| - |
|
7 |
import org.springframework.context.annotation.Bean;
|
| 7 |
import org.springframework.context.annotation.ComponentScan;
|
8 |
import org.springframework.context.annotation.ComponentScan;
|
| 8 |
import org.springframework.context.annotation.Configuration;
|
9 |
import org.springframework.context.annotation.Configuration;
|
| 9 |
import org.springframework.format.FormatterRegistry;
|
10 |
import org.springframework.format.FormatterRegistry;
|
| 10 |
import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar;
|
11 |
import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar;
|
| 11 |
import org.springframework.http.MediaType;
|
12 |
import org.springframework.http.MediaType;
|
| 12 |
import org.springframework.http.converter.HttpMessageConverter;
|
13 |
import org.springframework.http.converter.HttpMessageConverter;
|
| - |
|
14 |
import org.springframework.http.converter.StringHttpMessageConverter;
|
| 13 |
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
15 |
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
| - |
|
16 |
import org.springframework.web.servlet.LocaleResolver;
|
| 14 |
import org.springframework.web.servlet.config.annotation.*;
|
17 |
import org.springframework.web.servlet.config.annotation.*;
|
| - |
|
18 |
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
|
| - |
|
19 |
import org.springframework.web.servlet.i18n.SessionLocaleResolver;
|
| 15 |
|
20 |
|
| - |
|
21 |
import java.nio.charset.StandardCharsets;
|
| - |
|
22 |
import java.util.Arrays;
|
| 16 |
import java.util.List;
|
23 |
import java.util.List;
|
| - |
|
24 |
import java.util.Locale;
|
| 17 |
|
25 |
|
| 18 |
@EnableWebMvc
|
26 |
@EnableWebMvc
|
| 19 |
@Configuration
|
27 |
@Configuration
|
| 20 |
@ComponentScan({ "com.spice.profitmandi.*" })
|
28 |
@ComponentScan({ "com.spice.profitmandi.*" })
|
| 21 |
public class WebConfig extends WebMvcConfigurerAdapter {
|
29 |
public class WebConfig extends WebMvcConfigurerAdapter {
|
| Line 38... |
Line 46... |
| 38 |
}
|
46 |
}
|
| 39 |
|
47 |
|
| 40 |
@Override
|
48 |
@Override
|
| 41 |
public void addInterceptors(InterceptorRegistry registry) {
|
49 |
public void addInterceptors(InterceptorRegistry registry) {
|
| 42 |
// registry.addInterceptor()
|
50 |
// registry.addInterceptor()
|
| - |
|
51 |
registry.addInterceptor(localeChangeInterceptor());
|
| 43 |
registry.addInterceptor(authenticationInterceptor).addPathPatterns("/**").excludePathPatterns("/hdfctest/**",
|
52 |
registry.addInterceptor(authenticationInterceptor).addPathPatterns("/**").excludePathPatterns("/hdfctest/**",
|
| 44 |
"/hdfc/**", "/spicemoney/callback", "/login", "/login/", "/forgetPassword", "/forgetPassword/", "/",
|
53 |
"/hdfc/**", "/spicemoney/callback", "/login", "/login/", "/forgetPassword", "/forgetPassword/", "/",
|
| 45 |
"/checkplans", "/12dashboard34", "/mandii", "/imei/validate", "/fundfina/**", "/virtualaccount/push-credits", "/wa-invoice-send/**", "/wa-listen");
|
54 |
"/checkplans", "/12dashboard34", "/mandii", "/imei/validate", "/fundfina/**", "/virtualaccount/push-credits", "/wa-invoice-send/**", "/wa-listen");
|
| 46 |
registry.addInterceptor(roleInterceptor).excludePathPatterns("/hdfctest/**", "/hdfc/**", "/spicemoney/callback",
|
55 |
registry.addInterceptor(roleInterceptor).excludePathPatterns("/hdfctest/**", "/hdfc/**", "/spicemoney/callback",
|
| 47 |
"/login", "/login/", "/register", "/register/", "/forgetPassword", "/forgetPassword/", "/", "",
|
56 |
"/login", "/login/", "/register", "/register/", "/forgetPassword", "/forgetPassword/", "/", "",
|
| Line 64... |
Line 73... |
| 64 |
@Override
|
73 |
@Override
|
| 65 |
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
|
74 |
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
|
| 66 |
configurer.defaultContentType(MediaType.APPLICATION_JSON_UTF8);
|
75 |
configurer.defaultContentType(MediaType.APPLICATION_JSON_UTF8);
|
| 67 |
}
|
76 |
}
|
| 68 |
|
77 |
|
| - |
|
78 |
@Bean
|
| - |
|
79 |
public LocaleResolver localeResolver() {
|
| - |
|
80 |
SessionLocaleResolver slr = new SessionLocaleResolver();
|
| - |
|
81 |
slr.setDefaultLocale(Locale.US);
|
| - |
|
82 |
return slr;
|
| - |
|
83 |
}
|
| - |
|
84 |
|
| - |
|
85 |
@Bean
|
| - |
|
86 |
public LocaleChangeInterceptor localeChangeInterceptor() {
|
| - |
|
87 |
LocaleChangeInterceptor lci = new LocaleChangeInterceptor();
|
| - |
|
88 |
lci.setParamName("lang");
|
| - |
|
89 |
return lci;
|
| - |
|
90 |
}
|
| - |
|
91 |
|
| - |
|
92 |
|
| - |
|
93 |
@Override
|
| - |
|
94 |
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
| - |
|
95 |
StringHttpMessageConverter stringConverter = new StringHttpMessageConverter();
|
| - |
|
96 |
stringConverter.setSupportedMediaTypes(Arrays.asList(new MediaType("text", "plain", StandardCharsets.UTF_8)));
|
| - |
|
97 |
converters.add(stringConverter);
|
| - |
|
98 |
|
| - |
|
99 |
// Add other converters ...
|
| - |
|
100 |
}
|
| - |
|
101 |
|
| - |
|
102 |
|
| 69 |
}
|
103 |
}
|