/**
* Registered interceptor to all request except passed urls.
* @param registry helps with configuring a list of mapped interceptors.
* @param interceptor the interceptor
*/
protected void registerTenantInterceptorWithIgnorePathPattern(
InterceptorRegistry registry, HandlerInterceptor interceptor) {
InterceptorRegistration tenantInterceptorRegistration = registry.addInterceptor(interceptor);
tenantInterceptorRegistration.addPathPatterns("/**");
List<String> tenantIgnorePathPatterns = getTenantIgnorePathPatterns();
Objects.requireNonNull(tenantIgnorePathPatterns, "tenantIgnorePathPatterns can't be null");
for (String pattern : tenantIgnorePathPatterns) {
tenantInterceptorRegistration.excludePathPatterns(pattern);
}
LOGGER.info("Added handler interceptor '{}' to all urls, exclude {}", interceptor.getClass()
.getSimpleName(), tenantIgnorePathPatterns);
}
java类org.springframework.web.servlet.config.annotation.InterceptorRegistration的实例源码
XmWebMvcConfigurerAdapter.java 文件源码
项目:xm-commons
阅读 27
收藏 0
点赞 0
评论 0
DevCloudWebMvcConfigurer.java 文件源码
项目:service-hive
阅读 25
收藏 0
点赞 0
评论 0
/**
* 添加令牌处理拦截器,检查请求头是否带有效的令牌。
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
InterceptorRegistration interceptor = registry.addInterceptor(tokenInterceptor);
String pathPatterns = devcloudProperties.getPathPatterns();
log.info("Interceptor path patterns: " + pathPatterns);
if (pathPatterns == null || pathPatterns.isEmpty()) {
return;
}
String[] paths = pathPatterns.split(",");
if (paths == null || paths.length == 0) {
return;
}
for (String path : paths) {
interceptor.addPathPatterns(path);
}
}
BootMvcConfigurerAdapter.java 文件源码
项目:onetwo
阅读 43
收藏 0
点赞 0
评论 0
@Override
public void addInterceptors(InterceptorRegistry registry) {
/*Optional.ofNullable(interceptorList).ifPresent(list->{
list.stream().forEach(inter->registry.addInterceptor(inter));
});*/
if(LangUtils.isEmpty(interceptorList)){
return ;
}
for(HandlerInterceptor inter : interceptorList){
InterceptorRegistration reg = registry.addInterceptor(inter);
if(inter instanceof WebInterceptorAdapter){
WebInterceptorAdapter webinter = (WebInterceptorAdapter) inter;
if(LangUtils.isEmpty(webinter.getPathPatterns())){
continue;
}
reg.addPathPatterns(webinter.getPathPatterns());
}
}
// registry.addInterceptor(new BootFirstInterceptor());
}
StandaloneMockMvcBuilder.java 文件源码
项目:spring4-understanding
阅读 25
收藏 0
点赞 0
评论 0
@Override
protected void addInterceptors(InterceptorRegistry registry) {
for (MappedInterceptor interceptor : mappedInterceptors) {
InterceptorRegistration registration = registry.addInterceptor(interceptor.getInterceptor());
if (interceptor.getPathPatterns() != null) {
registration.addPathPatterns(interceptor.getPathPatterns());
}
}
}
AccessLogInterceptorConfigurerAdapter.java 文件源码
项目:onetwo
阅读 31
收藏 0
点赞 0
评论 0
@Override
public void addInterceptors(InterceptorRegistry registry) {
InterceptorRegistration reg = registry.addInterceptor(loggerInterceptor);
if(LangUtils.isEmpty(loggerInterceptor.getPathPatterns())){
return ;
}
reg.addPathPatterns(loggerInterceptor.getPathPatterns());
}
StandaloneMockMvcBuilder.java 文件源码
项目:class-guard
阅读 25
收藏 0
点赞 0
评论 0
@Override
protected void addInterceptors(InterceptorRegistry registry) {
for (MappedInterceptor interceptor : mappedInterceptors) {
InterceptorRegistration registration = registry.addInterceptor(interceptor.getInterceptor());
if (interceptor.getPathPatterns() != null) {
registration.addPathPatterns(interceptor.getPathPatterns());
}
}
}
WebMvcContextConfiguration.java 文件源码
项目:Daily-Email-WebApp
阅读 27
收藏 0
点赞 0
评论 0
@Override
public void addInterceptors(InterceptorRegistry registry) {
@SuppressWarnings("unused")
InterceptorRegistration registration = registry.addInterceptor(
new SecurityHandlerInterceptor()).addPathPatterns("/account",
"/account/*", "/reader", "/reader/*");
}
FilterPreInterceptorConfigurer.java 文件源码
项目:filter
阅读 25
收藏 0
点赞 0
评论 0
public void addInterceptors(InterceptorRegistry registry) {
InterceptorRegistration filterResponseInterceptor = registry.addInterceptor(new FilterResponseInterceptor(filterPreResponseHandler));
// 拦截配置
filterResponseInterceptor.addPathPatterns("/**");
try {
filterInterceptor = applicationContext.getBean(FilterInterceptor.class);
}catch (Exception e){
}
logger.info("filterInterceptor->"+filterInterceptor);
if(filterInterceptor!=null){
filterInterceptor.addInterceptors(registry);
}
}
ApplicationConfigurationTest.java 文件源码
项目:SpringBootMagicEightBallProject
阅读 30
收藏 0
点赞 0
评论 0
@Before
public void setUp() throws Exception {
applicationConfiguration = new ApplicationConfiguration(tenantInterceptorAdapter);
when(registry.addInterceptor(tenantInterceptorAdapter)).thenReturn(new InterceptorRegistration(tenantInterceptorAdapter));
}