org.springframework.web.servlet.config.annotation.InterceptorRegistry Java Examples

The following examples show how to use org.springframework.web.servlet.config.annotation.InterceptorRegistry. 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: InterceptorConfig.java    From charging_pile_cloud with MIT License 6 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
        //TODO 配置不需要拦截的路径 APP PC 都配置
        //配置 不需要拦截的包和请求
         String[]excludePathPatterns=new String[]{
                 "/js/**",
                 "/html/**",
                 "/layui/**",
                 "/static/**",
                 "/imge/**",
                 "/index.html",
                 "/main.html",
                 "/admin/user/login",
                 "/agent/user/login",
                 "/app/uart1/**",
                 "/app/chargeStation/**",
                 "/app/comConfig/**",
                 "/app/sms/**",
                 "/app/user/**",
                 "/common/**",
                 "/file/**"

        };
     registry.addInterceptor(  appinterceptor()).addPathPatterns("/**").excludePathPatterns(excludePathPatterns);

}
 
Example #2
Source File: WebAppConfig.java    From Tbed with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    // addPathPatterns("/**") 表示拦截所有的请求,
    // excludePathPatterns("/login", "/register") 表示除了登陆与注册之外,因为登陆注册不需要登陆也可以访问
    //registry.addInterceptor(interceptorConfig).addPathPatterns("admin/**").excludePathPatterns("/login", "/register");
    registry.addInterceptor(interceptorConfigWeb).addPathPatterns("/**")
            .excludePathPatterns("/static/**","/**/*.css", "/**/*.js", "/**/*.png", "/**/*.jpg",
                                    "/**/*.jpeg", "/**/*.gif", "/**/fonts/*", "/**/*.svg",
                    "/clientupimg/**","/clientupurlimg/**","/clientlogin/**","/notices/**","/systemupdate/**","/getdomain/**",
                    "/getNoticeText/**","/getNotice/**","/addalbum/**","/addalbum/**","/SaveForAlbum/**","/TOALBUM*N/**","/TOALBUM*N/**");
    registry.addInterceptor(interceptorConfig).addPathPatterns("/admin/**");
    registry.addInterceptor(interceptorConfigTwo).addPathPatterns("/admin/root/**");



}
 
Example #3
Source File: ApplicationConfig.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(new MemberInterceptor())
            .addPathPatterns("/**")
            .excludePathPatterns("/register/**", "/mobile/code","/login","/check/login","/start/captcha","/support/country",
                    "/ancillary/**","/announcement/**","/mobile/reset/code","/reset/email/code","/reset/login/password","/vote/info","/coin/supported","/financial/items/**","/coin/guess/index","/coin/guess/record"
                    ,"/coin/guess/detail"
                    ,"/coin/guess/type");
    super.addInterceptors(registry);
}
 
Example #4
Source File: InterceptorConfig.java    From liteflow with Apache License 2.0 5 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {

    registry.addInterceptor(loginInterceptor())
            .addPathPatterns("/console/**", "/executor/**")
            .excludePathPatterns("/console/login");

    registry.addInterceptor(authCheckInterceptor())
            .addPathPatterns("/console/**", "/executor/**")
            .excludePathPatterns("/console/login");

}
 
Example #5
Source File: ApplicationConfig.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(new MemberInterceptor())
            .addPathPatterns("/order/**", "/favor/**")
            .excludePathPatterns("/register/**","/order/time_limit");
    super.addInterceptors(registry);
}
 
Example #6
Source File: ApplicationConfig.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(new SessionInterceptor()).addPathPatterns("/**")
            .excludePathPatterns("/code/sms-provider/**","/captcha","/system/employee/sign/in",
                    "/system/employee/check","/system/employee/logout");
    registry.addInterceptor(new LogInterceptor()).addPathPatterns("/**");
    registry.addInterceptor(new OutExcelInterceptor()).addPathPatterns("/**/out-excel");
    super.addInterceptors(registry);
}
 
Example #7
Source File: WebConfig.java    From erp-framework with MIT License 5 votes vote down vote up
@Override
protected void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(new MyHandlerInterceptor())
            .addPathPatterns("/**").excludePathPatterns("/static/**", "/assets/**", "/css/**", "/images/**", "/layui_ext/**",
                "/login", "/login/main", "/genCaptcha");
    super.addInterceptors(registry);
}
 
Example #8
Source File: CurrentInterceptorConfig.java    From SnowJena with Apache License 2.0 5 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    if (monitorInterceptor!=null){
        registry.addInterceptor(monitorInterceptor).addPathPatterns("/**");
    }
    registry.addInterceptor(myHandlerInterceptor).addPathPatterns("/**");
}
 
Example #9
Source File: WebMvcConfig.java    From MyCommunity with Apache License 2.0 5 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(loginTicketInterceptor)
            .excludePathPatterns("/**/*.css", "/**/*.js", "/**/*.png", "/**/*.jpg", "/**/*.jpeg");

    registry.addInterceptor(loginOnlyOneInterceptor)
            .addPathPatterns("/login");

    registry.addInterceptor(messageInterceptor)
            .excludePathPatterns("/**/*.css", "/**/*.js", "/**/*.png", "/**/*.jpg", "/**/*.jpeg");

}
 
Example #10
Source File: AuthorityWebConfiguration.java    From zuihou-admin-boot with Apache License 2.0 5 votes vote down vote up
/**
 * 注册 拦截器
 *
 * @param registry
 */
@Override
public void addInterceptors(InterceptorRegistry registry) {
    String[] commonPathPatterns = getExcludeCommonPathPatterns();
    registry.addInterceptor(getTokenHandlerInterceptor())
            .addPathPatterns("/**")
            .order(5)
            .excludePathPatterns(commonPathPatterns);
    WebMvcConfigurer.super.addInterceptors(registry);
}
 
Example #11
Source File: InterceptorConfig.java    From yfshop with Apache License 2.0 5 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    // 常量拦截器
    registry.addInterceptor(constantsInterceptor())
            .addPathPatterns("/**")
            .excludePathPatterns("/static/**");
}
 
Example #12
Source File: WebMvcConfig.java    From springboot-learn with MIT License 5 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(rememberAuthenticationInterceptor)
            .excludePathPatterns("/login", "/error/**", "/assets/**", "/static/**")
            .addPathPatterns("/**");

}
 
Example #13
Source File: MyWebAppConfigurer.java    From star-zone with Apache License 2.0 5 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    // 多个拦截器组成一个拦截器链
    // addPathPatterns 用于添加拦截规则
    // excludePathPatterns 用户排除拦截
    registry.addInterceptor(loginInterceptor).addPathPatterns("/mobile/**");
}
 
Example #14
Source File: NeeBeeMallWebMvcConfigurer.java    From newbee-mall with GNU General Public License v3.0 5 votes vote down vote up
public void addInterceptors(InterceptorRegistry registry) {
    // 添加一个拦截器,拦截以/admin为前缀的url路径(后台登陆拦截)
    registry.addInterceptor(adminLoginInterceptor)
            .addPathPatterns("/admin/**")
            .excludePathPatterns("/admin/login")
            .excludePathPatterns("/admin/dist/**")
            .excludePathPatterns("/admin/plugins/**");
    // 购物车中的数量统一处理
    registry.addInterceptor(newBeeMallCartNumberInterceptor)
            .excludePathPatterns("/admin/**")
            .excludePathPatterns("/register")
            .excludePathPatterns("/login")
            .excludePathPatterns("/logout");
    // 商城页面登陆拦截
    registry.addInterceptor(newBeeMallLoginInterceptor)
            .excludePathPatterns("/admin/**")
            .excludePathPatterns("/register")
            .excludePathPatterns("/login")
            .excludePathPatterns("/logout")
            .addPathPatterns("/goods/detail/**")
            .addPathPatterns("/shop-cart")
            .addPathPatterns("/shop-cart/**")
            .addPathPatterns("/saveOrder")
            .addPathPatterns("/orders")
            .addPathPatterns("/orders/**")            
            .addPathPatterns("/personal")
            .addPathPatterns("/personal/updateInfo")
            .addPathPatterns("/selectPayType")
            .addPathPatterns("/payPage");
}
 
Example #15
Source File: SpringMvcConfiguration.java    From molicode with Apache License 2.0 5 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(logInterceptor).addPathPatterns("/**");
    registry.addInterceptor(loginInterceptor).addPathPatterns("/**").excludePathPatterns("/loginfree/**", "/dist/**", "", "/index.html");
    registry.addInterceptor(privilegeInterceptor).addPathPatterns("/**").excludePathPatterns("/loginfree/**", "/dist/**", "", "/index.html");

}
 
Example #16
Source File: SnowAuthorizingInterceptorRegister.java    From tools with MIT License 5 votes vote down vote up
/**
 * Register permission interceptors
 *
 * @param registry InterceptorRegistry
 */
@Override
public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(authorizingMethodInterceptor)
            .addPathPatterns(this.authorizationInfo.getPath())
            .excludePathPatterns(this.authorizationInfo.getFilter());
}
 
Example #17
Source File: SystemConfigurer.java    From jeewx-boot with Apache License 2.0 5 votes vote down vote up
/**
* 拦截器(登录 + 签名)
*/
  public void addInterceptors(InterceptorRegistry registry) {
  	if(isOpen) {
  		log.info("loginInterceptorExcludeUrls: "+loginInterceptorExcludeUrls);
  		log.info("accessSignInterceptorExcludeUrls: "+accessSignInterceptorExcludeUrls);
  		registry.addInterceptor(loginInterceptor).addPathPatterns("/**/back/**/*").excludePathPatterns(EXCLUDE_PATHS).excludePathPatterns(loginInterceptorExcludeUrls.split(","));
  		registry.addInterceptor(accessSignInterceptor).addPathPatterns("/**").excludePathPatterns("/**/back/**").excludePathPatterns(EXCLUDE_PATHS).excludePathPatterns(accessSignInterceptorExcludeUrls.split(","));
  	}
  }
 
Example #18
Source File: InterceptorConfiguration.java    From BigDataPlatform with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {

    // 注册拦截器
    InterceptorRegistration ir = registry.addInterceptor(limitRaterInterceptor);
    // 配置拦截的路径
    ir.addPathPatterns("/**");
}
 
Example #19
Source File: MyBlogWebMvcConfigurer.java    From My-Blog-layui with Apache License 2.0 5 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    // 添加一个拦截器,拦截以/admin为前缀的url路径
    registry.addInterceptor(adminLoginInterceptor)
            .addPathPatterns("/admin/**")
            .excludePathPatterns("/admin/v1/login")
            .excludePathPatterns("/admin/v1/reload")
            .excludePathPatterns("/admin/dist/**")
            .excludePathPatterns("/admin/plugins/**")
            .excludePathPatterns("/X-admin/**");
}
 
Example #20
Source File: StandaloneMockMvcBuilder.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@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 #21
Source File: AppConfig.java    From Mastering-Microservices-with-Java-Third-Edition with MIT License 4 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
  registry.addInterceptor(localeChangeInterceptor());
}
 
Example #22
Source File: HttpInterceptorConfig.java    From WeEvent with Apache License 2.0 4 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    HttpInterceptor httpInterceptor = new HttpInterceptor(this.weEventConfig.getIpWhiteList());
    registry.addInterceptor(httpInterceptor).addPathPatterns("/**");
}
 
Example #23
Source File: WebMvcConfig.java    From xechat with MIT License 4 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(permissionInterceptor).addPathPatterns("/api/record/**", "/chatrecord/**");
}
 
Example #24
Source File: ApplicationConfig.java    From dog with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(new WebInterceptor());
}
 
Example #25
Source File: LiteWebConfiguration.java    From singleton with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * 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()).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);

	}

	// 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 LiteAPICrossDomainInterceptor(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 #26
Source File: SpringWebConfig.java    From wecube-platform with Apache License 2.0 4 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(authenticationRequestContextInterceptor).addPathPatterns("/**");
    WebMvcConfigurer.super.addInterceptors(registry);
}
 
Example #27
Source File: WebAppConfigurer.java    From frostmourne with MIT License 4 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(permissionInterceptor).addPathPatterns("/**");
}
 
Example #28
Source File: AuthWebMvcConfigurerAdapter.java    From seppb with MIT License 4 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(apiPermissionInterceptor);
}
 
Example #29
Source File: MvcConfig.java    From leyou with Apache License 2.0 4 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(loginInterceptor()).addPathPatterns("/**");
}
 
Example #30
Source File: TracingConfiguration.java    From txle with Apache License 2.0 4 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(webMvcTracingCustomizer);
}