本文整理匯總了Java中org.springframework.boot.web.servlet.FilterRegistrationBean.setMatchAfter方法的典型用法代碼示例。如果您正苦於以下問題:Java FilterRegistrationBean.setMatchAfter方法的具體用法?Java FilterRegistrationBean.setMatchAfter怎麽用?Java FilterRegistrationBean.setMatchAfter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.boot.web.servlet.FilterRegistrationBean
的用法示例。
在下文中一共展示了FilterRegistrationBean.setMatchAfter方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: csrfFilterRegistrationBean
import org.springframework.boot.web.servlet.FilterRegistrationBean; //導入方法依賴的package包/類
/**
* @return CSRF protection filter bean
*/
@Bean
public FilterRegistrationBean csrfFilterRegistrationBean() {
String path = "/*";
logger.debug("Initializing CSRF filter [{}]...", path);
FilterRegistrationBean frb = new FilterRegistrationBean(new CsrfFilter());
frb.setDispatcherTypes(EnumSet.of(DispatcherType.REQUEST));
frb.setName("csrfFilter");
frb.setAsyncSupported(true);
frb.addUrlPatterns(path);
frb.setMatchAfter(false);
frb.setEnabled(true);
frb.setOrder(2);
return frb;
}
示例2: juiserForwardedUserFilter
import org.springframework.boot.web.servlet.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean
@ConditionalOnMissingBean(name = "juiserForwardedUserFilter")
public FilterRegistrationBean juiserForwardedUserFilter() {
ForwardedUserFilterConfig cfg = juiserForwardedUserFilterConfig();
Filter filter = new SpringForwardedUserFilter(forwardedHeaderConfig().getName(),
juiserRequestUserFactory(),
cfg.getRequestAttributeNames());
FilterRegistrationBean bean = new FilterRegistrationBean();
bean.setFilter(filter);
bean.setEnabled(cfg.isEnabled());
bean.setMatchAfter(cfg.isMatchAfter());
bean.setOrder(cfg.getOrder());
Set<DispatcherType> dispatcherTypes = cfg.getDispatcherTypes();
if (!CollectionUtils.isEmpty(dispatcherTypes)) {
bean.setDispatcherTypes(EnumSet.copyOf(dispatcherTypes));
}
Set<String> set = cfg.getServletNames();
if (!CollectionUtils.isEmpty(set)) {
bean.setServletNames(set);
}
set = cfg.getUrlPatterns();
if (!CollectionUtils.isEmpty(set)) {
bean.setUrlPatterns(set);
}
return bean;
}