本文整理汇总了Java中org.springframework.web.servlet.config.annotation.InterceptorRegistration.addPathPatterns方法的典型用法代码示例。如果您正苦于以下问题:Java InterceptorRegistration.addPathPatterns方法的具体用法?Java InterceptorRegistration.addPathPatterns怎么用?Java InterceptorRegistration.addPathPatterns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.web.servlet.config.annotation.InterceptorRegistration
的用法示例。
在下文中一共展示了InterceptorRegistration.addPathPatterns方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerTenantInterceptorWithIgnorePathPattern
import org.springframework.web.servlet.config.annotation.InterceptorRegistration; //导入方法依赖的package包/类
/**
* 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);
}
示例2: addInterceptors
import org.springframework.web.servlet.config.annotation.InterceptorRegistration; //导入方法依赖的package包/类
/**
* 添加令牌处理拦截器,检查请求头是否带有效的令牌。
*/
@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);
}
}
示例3: addInterceptors
import org.springframework.web.servlet.config.annotation.InterceptorRegistration; //导入方法依赖的package包/类
@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());
}
示例4: addInterceptors
import org.springframework.web.servlet.config.annotation.InterceptorRegistration; //导入方法依赖的package包/类
@Override
protected void addInterceptors(InterceptorRegistry registry) {
for (MappedInterceptor interceptor : mappedInterceptors) {
InterceptorRegistration registration = registry.addInterceptor(interceptor.getInterceptor());
if (interceptor.getPathPatterns() != null) {
registration.addPathPatterns(interceptor.getPathPatterns());
}
}
}
示例5: addInterceptors
import org.springframework.web.servlet.config.annotation.InterceptorRegistration; //导入方法依赖的package包/类
@Override
public void addInterceptors(InterceptorRegistry registry) {
InterceptorRegistration reg = registry.addInterceptor(loggerInterceptor);
if(LangUtils.isEmpty(loggerInterceptor.getPathPatterns())){
return ;
}
reg.addPathPatterns(loggerInterceptor.getPathPatterns());
}
示例6: addInterceptors
import org.springframework.web.servlet.config.annotation.InterceptorRegistration; //导入方法依赖的package包/类
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);
}
}