org.springframework.web.servlet.config.annotation.InterceptorRegistration Java Examples
The following examples show how to use
org.springframework.web.servlet.config.annotation.InterceptorRegistration.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BootMvcConfigurerAdapter.java From onetwo with Apache License 2.0 | 6 votes |
@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()); }
Example #2
Source File: WebSecurityConfig.java From redis-manager with Apache License 2.0 | 6 votes |
@Override public void addInterceptors(InterceptorRegistry registry) { InterceptorRegistration addInterceptor = registry.addInterceptor(getSecurityInterceptor()); // 排除配置 addInterceptor.excludePathPatterns("/") .excludePathPatterns("/eureka-ui") .excludePathPatterns("/index") .excludePathPatterns("/login") .excludePathPatterns("/user/login") .excludePathPatterns("/user/signOut") .excludePathPatterns("/user/getUserFromSession") .excludePathPatterns("/system/getAuthorization") .excludePathPatterns("/system/getInstallationEnvironment") .excludePathPatterns("/static/**") .excludePathPatterns("/data/**") .excludePathPatterns("/logo.ico"); // 拦截配置 addInterceptor.addPathPatterns("/**"); }
Example #3
Source File: AoomsInterceptorRegistryProxy.java From Aooms with Apache License 2.0 | 6 votes |
/** * 添加拦截器 * @param interceptor */ public void addInterceptor(AoomsAbstractInterceptor interceptor){ if(interceptorRegistry == null) throw AoomsExceptions.create("InterceptorRegistry is null"); // 不重复添加 if(interceptorNames.contains(interceptor.getClass().getName())){ return; } if(interceptor.getPathPatterns() == null) throw AoomsExceptions.create("Interceptor " +interceptor.getClass().getName() + " PathPatterns is null"); InterceptorRegistration interceptorRegistration = interceptorRegistry.addInterceptor(new AoomsInterceptorAdaptor(interceptor)); interceptorRegistration.addPathPatterns(interceptor.getPathPatterns()); if(interceptor.getIgnores() != null){ interceptorRegistration.excludePathPatterns(interceptor.getIgnores()); } interceptor.setAoomsInterceptorRegistryProxy(this); interceptors.add(interceptor.getClass()); interceptorNames.add(interceptor.getClass().getName()); }
Example #4
Source File: LoginConfiguration.java From fabric-net-server with Apache License 2.0 | 6 votes |
@Override public void addInterceptors(InterceptorRegistry registry) { LoginInterceptor loginInterceptor = loginInterceptor(); InterceptorRegistration loginRegistry = registry.addInterceptor(loginInterceptor); // 拦截路径 loginRegistry.addPathPatterns(loginInterceptor.LEAGUE); loginRegistry.addPathPatterns(loginInterceptor.ORG); loginRegistry.addPathPatterns(loginInterceptor.ORDERER); loginRegistry.addPathPatterns(loginInterceptor.PEER); loginRegistry.addPathPatterns(loginInterceptor.CHANNEL); loginRegistry.addPathPatterns(loginInterceptor.CHAINCODE); loginRegistry.addPathPatterns(loginInterceptor.APP); loginRegistry.addPathPatterns(loginInterceptor.CA); loginRegistry.addPathPatterns(loginInterceptor.USER); loginRegistry.addPathPatterns(loginInterceptor.INDEX); }
Example #5
Source File: WebSecurityConfig.java From CAS with Apache License 2.0 | 5 votes |
@Override public void addInterceptors(InterceptorRegistry registry) { InterceptorRegistration addInterceptor = registry.addInterceptor(getSecurityInterceptor()); //设定匹配的优先级 // addInterceptor.excludePathPatterns("/error"); addInterceptor.excludePathPatterns("/api/user/login/**"); addInterceptor.excludePathPatterns("/api/user/caslogin/**"); addInterceptor.addPathPatterns("/**"); }
Example #6
Source File: AccessLogInterceptorConfigurerAdapter.java From onetwo with Apache License 2.0 | 5 votes |
@Override public void addInterceptors(InterceptorRegistry registry) { InterceptorRegistration reg = registry.addInterceptor(loggerInterceptor); if(LangUtils.isEmpty(loggerInterceptor.getPathPatterns())){ return ; } reg.addPathPatterns(loggerInterceptor.getPathPatterns()); }
Example #7
Source File: StandaloneMockMvcBuilder.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override protected void addInterceptors(InterceptorRegistry registry) { for (MappedInterceptor interceptor : mappedInterceptors) { InterceptorRegistration registration = registry.addInterceptor(interceptor.getInterceptor()); if (interceptor.getPathPatterns() != null) { registration.addPathPatterns(interceptor.getPathPatterns()); } } }
Example #8
Source File: WebMvcConfig.java From spring-boot-demo with MIT License | 5 votes |
@Override public void addInterceptors(InterceptorRegistry registry) { InterceptorRegistration sessionInterceptorRegistry = registry.addInterceptor(sessionInterceptor); // 排除不需要拦截的路径 sessionInterceptorRegistry.excludePathPatterns("/page/login"); sessionInterceptorRegistry.excludePathPatterns("/page/doLogin"); sessionInterceptorRegistry.excludePathPatterns("/error"); // 需要拦截的路径 sessionInterceptorRegistry.addPathPatterns("/**"); }
Example #9
Source File: WebMvcConfig.java From spring-boot-demo with MIT License | 5 votes |
@Override public void addInterceptors(InterceptorRegistry registry) { InterceptorRegistration sessionInterceptorRegistry = registry.addInterceptor(sessionInterceptor); // 排除不需要拦截的路径 sessionInterceptorRegistry.excludePathPatterns("/page/login"); sessionInterceptorRegistry.excludePathPatterns("/page/doLogin"); sessionInterceptorRegistry.excludePathPatterns("/error"); // 需要拦截的路径 sessionInterceptorRegistry.addPathPatterns("/**"); }
Example #10
Source File: WebSecurityConfig.java From CAS with Apache License 2.0 | 5 votes |
@Override public void addInterceptors(InterceptorRegistry registry) { InterceptorRegistration addInterceptor = registry.addInterceptor(getSecurityInterceptor()); //设定匹配的优先级 addInterceptor.excludePathPatterns("/error"); addInterceptor.excludePathPatterns("/login**"); addInterceptor.addPathPatterns("/**"); }
Example #11
Source File: WebSecurityConfig.java From CAS with Apache License 2.0 | 5 votes |
@Override public void addInterceptors(InterceptorRegistry registry) { InterceptorRegistration addInterceptor = registry.addInterceptor(getSecurityInterceptor()); //设定匹配的优先级 addInterceptor.excludePathPatterns("/error"); addInterceptor.excludePathPatterns("/login**"); addInterceptor.addPathPatterns("/**"); }
Example #12
Source File: InterceptorConfiguration.java From BigDataPlatform with GNU General Public License v3.0 | 5 votes |
@Override public void addInterceptors(InterceptorRegistry registry) { // 注册拦截器 InterceptorRegistration ir = registry.addInterceptor(limitRaterInterceptor); // 配置拦截的路径 ir.addPathPatterns("/**"); }
Example #13
Source File: StandaloneMockMvcBuilder.java From java-technology-stack with MIT License | 5 votes |
@Override protected void addInterceptors(InterceptorRegistry registry) { for (MappedInterceptor interceptor : mappedInterceptors) { InterceptorRegistration registration = registry.addInterceptor(interceptor.getInterceptor()); if (interceptor.getPathPatterns() != null) { registration.addPathPatterns(interceptor.getPathPatterns()); } } }
Example #14
Source File: WebMvcConfig.java From spring-boot-demo with MIT License | 5 votes |
@Override public void addInterceptors(InterceptorRegistry registry) { InterceptorRegistration sessionInterceptorRegistry = registry.addInterceptor(sessionInterceptor); // 排除不需要拦截的路径 sessionInterceptorRegistry.excludePathPatterns("/page/login"); sessionInterceptorRegistry.excludePathPatterns("/page/doLogin"); sessionInterceptorRegistry.excludePathPatterns("/error"); // 需要拦截的路径 sessionInterceptorRegistry.addPathPatterns("/**"); }
Example #15
Source File: StandaloneMockMvcBuilder.java From spring-analysis-note with MIT License | 5 votes |
@Override protected void addInterceptors(InterceptorRegistry registry) { for (MappedInterceptor interceptor : mappedInterceptors) { InterceptorRegistration registration = registry.addInterceptor(interceptor.getInterceptor()); if (interceptor.getPathPatterns() != null) { registration.addPathPatterns(interceptor.getPathPatterns()); } } }
Example #16
Source File: WebConfiguration.java From singleton with Eclipse Public License 2.0 | 4 votes |
/** * Add interceptors for security or source collection, the filter path will * be configured here * * @param registry * The interceptor to add */ @Override public void addInterceptors(InterceptorRegistry registry) { /* * registry.addInterceptor(new APISecurityInterceptor()) * .addPathPatterns(ConstantsKeys.TOKEN_INTERCEP_PATH) * .excludePathPatterns("/i18n/api/v1/security/authentication"); */ // Request Validation InterceptorRegistration apival = registry.addInterceptor(new APIValidationInterceptor(productService.getWhiteList())).addPathPatterns("/**").excludePathPatterns(API.I18N_API_ROOT+"doc/**"); // authentication if (authConfig.getAuthSwitch().equalsIgnoreCase("true")) { logger.info("add enable authentication interceptor"); apival.excludePathPatterns("/auth/**"); registry.addInterceptor(apiAuthInter) .addPathPatterns(API.I18N_API_ROOT + APIV1.V + "/**") .addPathPatterns(API.I18N_API_ROOT + APIV2.V + "/**") .addPathPatterns(APIV1.COMPONENTS).excludePathPatterns(API.I18N_API_ROOT + APIV2.V+"/api-docs"); } // CSP authentication if (cspAuthFlag.equalsIgnoreCase("true")) { logger.info("add enable CSP authentication interceptor"); registry.addInterceptor(new AuthInterceptor(sourceCacheFlag, tokenService)) .addPathPatterns(API.I18N_API_ROOT + APIV2.V + "/**"); } // Source collection if (sourceCacheFlag.equalsIgnoreCase("true")) { logger.info("add enable Source collection interceptor"); registry.addInterceptor(new APISourceInterceptor(sourceCacheServerUrl)) .addPathPatterns(API.I18N_API_ROOT + APIV1.V + "/**") .addPathPatterns(API.I18N_API_ROOT + APIV2.V + "/**"); } //cross domain if (crossDomainFlag.equalsIgnoreCase("true")) { logger.info("add enable cross domain interceptor"); Set<String> allowSet = new HashSet<String>(Arrays.asList(allowOrigin.split(","))); registry.addInterceptor(new APICrossDomainInterceptor(allowSet, allowHeaders, allowMethods, allowCredentials, maxAge)) .addPathPatterns(API.I18N_API_ROOT + APIV1.V + "/**") .addPathPatterns(API.I18N_API_ROOT + APIV2.V + "/**"); } //cacheControl if (StringUtils.isNotEmpty(this.cacheControlValue)) { registry.addInterceptor(new APICacheControlInterceptor(this.cacheControlValue)).addPathPatterns(API.I18N_API_ROOT + APIV2.V + "/**"); } }
Example #17
Source File: WebConfiguration.java From chronus with Apache License 2.0 | 4 votes |
@Override public void addInterceptors(InterceptorRegistry registry) { InterceptorRegistration registration = registry.addInterceptor(new CsrfInterceptor()); registration.addPathPatterns("/api/**"); }