本文整理汇总了Java中org.springframework.web.servlet.config.annotation.InterceptorRegistry.addInterceptor方法的典型用法代码示例。如果您正苦于以下问题:Java InterceptorRegistry.addInterceptor方法的具体用法?Java InterceptorRegistry.addInterceptor怎么用?Java InterceptorRegistry.addInterceptor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.web.servlet.config.annotation.InterceptorRegistry
的用法示例。
在下文中一共展示了InterceptorRegistry.addInterceptor方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: baseConfigurerBean
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; //导入方法依赖的package包/类
@Bean
public WebMvcConfigurerAdapter baseConfigurerBean(@Named final ScooldRequestInterceptor sri) {
return new WebMvcConfigurerAdapter() {
@Override
public void addInterceptors(InterceptorRegistry registry) {
super.addInterceptors(registry);
registry.addInterceptor(sri);
}
// @Override
// public void addResourceHandlers(ResourceHandlerRegistry registry) {
// registry.addResourceHandler("/images/**").addResourceLocations("/static/images/")
// .setCacheControl(CacheControl.maxAge(1, TimeUnit.HOURS).cachePublic());
// registry.addResourceHandler("/styles/**").addResourceLocations("/static/styles/")
// .setCacheControl(CacheControl.maxAge(1, TimeUnit.HOURS).cachePublic());
// registry.addResourceHandler("/scripts/**").addResourceLocations("/static/scripts/")
// .setCacheControl(CacheControl.maxAge(1, TimeUnit.HOURS).cachePublic());
// }
};
}
示例2: addInterceptors
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; //导入方法依赖的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.InterceptorRegistry; //导入方法依赖的package包/类
@Override
public void addInterceptors(final InterceptorRegistry registry) {
registry.addInterceptor(localeChangeInterceptor());
registry.addInterceptor(casManagementSecurityInterceptor())
.addPathPatterns("/**").excludePathPatterns("/callback*", "/logout*", "/authorizationFailure");
}
示例4: addInterceptors
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; //导入方法依赖的package包/类
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(localeChangeInterceptor());
}
示例5: addInterceptors
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; //导入方法依赖的package包/类
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new TracingHandlerInterceptor(tracer, spanDecorators));
}
示例6: addInterceptors
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; //导入方法依赖的package包/类
@Override
public void addInterceptors(InterceptorRegistry registry) {
LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
localeChangeInterceptor.setParamName("language");
registry.addInterceptor(localeChangeInterceptor);
}
示例7: addInterceptors
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; //导入方法依赖的package包/类
@Override
public void addInterceptors(InterceptorRegistry registry) {// ②
registry.addInterceptor(demoInterceptor());
}
示例8: addInterceptors
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; //导入方法依赖的package包/类
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(authorizationInterceptor);
}
示例9: addInterceptors
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; //导入方法依赖的package包/类
@Override
public void addInterceptors(InterceptorRegistry registry) {
WebContentInterceptor interceptor = new WebContentInterceptor();
interceptor.addCacheMapping(CacheControl.maxAge(365, TimeUnit.DAYS), "/**");
registry.addInterceptor(interceptor);
}
示例10: addInterceptors
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; //导入方法依赖的package包/类
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(localeInterceptor());
}
示例11: addInterceptors
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; //导入方法依赖的package包/类
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(timelineInterceptor);
}