Java Code Examples for org.springframework.web.servlet.config.annotation.InterceptorRegistration#addPathPatterns()

The following examples show how to use org.springframework.web.servlet.config.annotation.InterceptorRegistration#addPathPatterns() . 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: AoomsInterceptorRegistryProxy.java    From Aooms with Apache License 2.0 6 votes vote down vote up
/**
 * 添加拦截器
 * @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 2
Source File: LoginConfiguration.java    From fabric-net-server with Apache License 2.0 6 votes vote down vote up
@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 3
Source File: WebSecurityConfig.java    From redis-manager with Apache License 2.0 6 votes vote down vote up
@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 4
Source File: BootMvcConfigurerAdapter.java    From onetwo with Apache License 2.0 6 votes vote down vote up
@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 5
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 6
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 7
Source File: WebMvcConfig.java    From spring-boot-demo with MIT License 5 votes vote down vote up
@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 8
Source File: StandaloneMockMvcBuilder.java    From java-technology-stack 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 9
Source File: WebSecurityConfig.java    From CAS with Apache License 2.0 5 votes vote down vote up
@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 10
Source File: WebSecurityConfig.java    From CAS with Apache License 2.0 5 votes vote down vote up
@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 vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    InterceptorRegistration addInterceptor = registry.addInterceptor(getSecurityInterceptor());

    //设定匹配的优先级

    addInterceptor.excludePathPatterns("/error");
    addInterceptor.excludePathPatterns("/login**");

    addInterceptor.addPathPatterns("/**");
}
 
Example 12
Source File: WebMvcConfig.java    From spring-boot-demo with MIT License 5 votes vote down vote up
@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 13
Source File: WebMvcConfig.java    From spring-boot-demo with MIT License 5 votes vote down vote up
@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 14
Source File: StandaloneMockMvcBuilder.java    From spring4-understanding with Apache License 2.0 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 15
Source File: AccessLogInterceptorConfigurerAdapter.java    From onetwo with Apache License 2.0 5 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
	InterceptorRegistration reg = registry.addInterceptor(loggerInterceptor);
	if(LangUtils.isEmpty(loggerInterceptor.getPathPatterns())){
		return ;
	}
	reg.addPathPatterns(loggerInterceptor.getPathPatterns());
}
 
Example 16
Source File: WebConfiguration.java    From chronus with Apache License 2.0 4 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    InterceptorRegistration registration = registry.addInterceptor(new CsrfInterceptor());
    registration.addPathPatterns("/api/**");
}