|
@@ -13,60 +13,65 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
|
|
*/
|
|
*/
|
|
@Configuration
|
|
@Configuration
|
|
@EnableWebMvc
|
|
@EnableWebMvc
|
|
-public class Config extends WebMvcConfigurerAdapter{
|
|
|
|
|
|
+public class Config extends WebMvcConfigurerAdapter {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 直接采用new interceptor或Autowired注入拦截器会导致dao为null的错误
|
|
* 直接采用new interceptor或Autowired注入拦截器会导致dao为null的错误
|
|
|
|
+ *
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Bean
|
|
@Bean
|
|
- AuthInterceptor authInterceptor(){
|
|
|
|
|
|
+ AuthInterceptor authInterceptor() {
|
|
return new AuthInterceptor();
|
|
return new AuthInterceptor();
|
|
}
|
|
}
|
|
|
|
|
|
@Bean
|
|
@Bean
|
|
- AdminInterceptor adminInterceptor(){
|
|
|
|
|
|
+ AdminInterceptor adminInterceptor() {
|
|
return new AdminInterceptor();
|
|
return new AdminInterceptor();
|
|
}
|
|
}
|
|
|
|
|
|
@Bean
|
|
@Bean
|
|
- AllowOriginIntercepter allowOriginIntercepter(){
|
|
|
|
|
|
+ AllowOriginIntercepter allowOriginIntercepter() {
|
|
return new AllowOriginIntercepter();
|
|
return new AllowOriginIntercepter();
|
|
}
|
|
}
|
|
|
|
|
|
@Bean
|
|
@Bean
|
|
- IgnoreOptionsInterceptor ignoreOptionsInterceptor(){
|
|
|
|
|
|
+ IgnoreOptionsInterceptor ignoreOptionsInterceptor() {
|
|
return new IgnoreOptionsInterceptor();
|
|
return new IgnoreOptionsInterceptor();
|
|
}
|
|
}
|
|
|
|
|
|
@Bean
|
|
@Bean
|
|
- ResLogInterceptor resLogInterceptor(){
|
|
|
|
|
|
+ ResLogInterceptor resLogInterceptor() {
|
|
return new ResLogInterceptor();
|
|
return new ResLogInterceptor();
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void addInterceptors(InterceptorRegistry registry) {
|
|
public void addInterceptors(InterceptorRegistry registry) {
|
|
registry.addInterceptor(authInterceptor())
|
|
registry.addInterceptor(authInterceptor())
|
|
- .addPathPatterns("/audio/search","/audio/searchList","/audio/info/{audioId}","/album","/album/{albumId}")
|
|
|
|
- .excludePathPatterns("/device/**", "/error","/audio/*");
|
|
|
|
|
|
+ .addPathPatterns("/audio/search", "/audio/searchList", "/audio/info/{audioId}", "/album", "/album/{albumId}")
|
|
|
|
+ .excludePathPatterns("/device/**", "/error", "/audio/*");
|
|
|
|
|
|
registry.addInterceptor(adminInterceptor())
|
|
registry.addInterceptor(adminInterceptor())
|
|
.addPathPatterns("/**", "/device/update", "/device/delete")
|
|
.addPathPatterns("/**", "/device/update", "/device/delete")
|
|
- .excludePathPatterns("/device/**","/audio/info/{audioId}", "/error", "/admin/login", "/audio/search","/file/**","/audio/searchList","/statistics","/album","/album/{albumId}")
|
|
|
|
- //杭研开放接口
|
|
|
|
- .excludePathPatterns("/getTypeList","/getTypeContentList","/getContentDetail","/getContentChapterList","/getChapterDetail","/getTypeUpdateList","/getContentUpdateList","/getChapterUpdateList");
|
|
|
|
|
|
+ .excludePathPatterns("/device/**", "/audio/info/{audioId}", "/error", "/admin/login", "/audio/search", "/file/**", "/audio/searchList", "/statistics", "/album", "/album/{albumId}")
|
|
|
|
+
|
|
|
|
+ .excludePathPatterns("/getTypeList", "/getTypeContentList", "/getContentDetail", "/getContentChapterList", "/getChapterDetail", "/getTypeUpdateList", "/getContentUpdateList", "/getChapterUpdateList", "/getTypeUpdateList/**", "/getContentUpdateList/**", "/getChapterUpdateList/**");
|
|
|
|
+
|
|
|
|
+ //杭研开放接口
|
|
|
|
+ //.excludePathPatterns("/getTypeList","/getTypeContentList","/getContentDetail","/getContentChapterList","/getChapterDetail","/getTypeUpdateList","/getContentUpdateList","/getChapterUpdateList");
|
|
|
|
+
|
|
|
|
|
|
registry.addInterceptor(ignoreOptionsInterceptor())
|
|
registry.addInterceptor(ignoreOptionsInterceptor())
|
|
.addPathPatterns("/**")
|
|
.addPathPatterns("/**")
|
|
//杭研开放接口
|
|
//杭研开放接口
|
|
- .excludePathPatterns("/getTypeList","/getTypeContentList","/getContentDetail","/getContentChapterList","/getChapterDetail","/getTypeUpdateList","/getContentUpdateList","/getChapterUpdateList");
|
|
|
|
|
|
+ .excludePathPatterns("/getTypeList", "/getTypeContentList", "/getContentDetail", "/getContentChapterList", "/getChapterDetail", "/getTypeUpdateList", "/getContentUpdateList", "/getChapterUpdateList");
|
|
|
|
|
|
registry.addInterceptor(allowOriginIntercepter())
|
|
registry.addInterceptor(allowOriginIntercepter())
|
|
.addPathPatterns("/**");
|
|
.addPathPatterns("/**");
|
|
|
|
|
|
//杭研接口日志拦截器
|
|
//杭研接口日志拦截器
|
|
registry.addInterceptor(resLogInterceptor())
|
|
registry.addInterceptor(resLogInterceptor())
|
|
- .addPathPatterns("/getTypeList","/getTypeContentList","/getContentDetail","/getContentChapterList","/getChapterDetail","/getTypeUpdateList","/getContentUpdateList","/getChapterUpdateList");
|
|
|
|
|
|
+ .addPathPatterns("/getTypeList", "/getTypeContentList", "/getContentDetail", "/getContentChapterList", "/getChapterDetail", "/getTypeUpdateList", "/getContentUpdateList", "/getChapterUpdateList");
|
|
}
|
|
}
|
|
|
|
|
|
// /**
|
|
// /**
|