本文整理匯總了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);
}