本文整理汇总了Java中org.springframework.web.filter.DelegatingFilterProxy.setContextAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java DelegatingFilterProxy.setContextAttribute方法的具体用法?Java DelegatingFilterProxy.setContextAttribute怎么用?Java DelegatingFilterProxy.setContextAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.web.filter.DelegatingFilterProxy
的用法示例。
在下文中一共展示了DelegatingFilterProxy.setContextAttribute方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerRestApiServlet
import org.springframework.web.filter.DelegatingFilterProxy; //导入方法依赖的package包/类
protected void registerRestApiServlet(ServletContext servletContext) {
CubaRestApiServlet cubaRestApiServlet = new SingleAppRestApiServlet(dependencyJars);
try {
cubaRestApiServlet.init(new CubaServletConfig("rest_api", servletContext));
} catch (ServletException e) {
throw new RuntimeException("An error occurred while initializing dispatcher servlet", e);
}
ServletRegistration.Dynamic cubaRestApiServletReg = servletContext.addServlet("rest_api", cubaRestApiServlet);
cubaRestApiServletReg.setLoadOnStartup(2);
cubaRestApiServletReg.addMapping("/rest/*");
DelegatingFilterProxy restSpringSecurityFilterChain = new DelegatingFilterProxy();
restSpringSecurityFilterChain.setContextAttribute("org.springframework.web.servlet.FrameworkServlet.CONTEXT.rest_api");
restSpringSecurityFilterChain.setTargetBeanName("springSecurityFilterChain");
FilterRegistration.Dynamic restSpringSecurityFilterChainReg =
servletContext.addFilter("restSpringSecurityFilterChain", restSpringSecurityFilterChain);
restSpringSecurityFilterChainReg.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "/rest/*");
}
示例2: registerIdpServlet
import org.springframework.web.filter.DelegatingFilterProxy; //导入方法依赖的package包/类
protected void registerIdpServlet(ServletContext servletContext) {
String serviceProvidersUrls = AppContext.getProperty(IDP_SERVICE_PROVIDERS_URLS);
if (StringUtils.isEmpty(serviceProvidersUrls)) {
log.debug("No service providers were found. IDP Servlet will not be started");
return;
}
CubaIdpServlet idpServlet = new SingleAppIdpServlet(dependencyJars);
try {
idpServlet.init(new CubaServletConfig("idp", servletContext));
} catch (ServletException e) {
throw new RuntimeException("An error occurred while initializing idp servlet", e);
}
ServletRegistration.Dynamic idpServletRegistration = servletContext.addServlet("idp", idpServlet);
idpServletRegistration.setLoadOnStartup(4);
idpServletRegistration.addMapping("/idp/*");
DelegatingFilterProxy idpSpringSecurityFilterChain = new DelegatingFilterProxy();
idpSpringSecurityFilterChain.setContextAttribute("org.springframework.web.servlet.FrameworkServlet.CONTEXT.idp");
idpSpringSecurityFilterChain.setTargetBeanName("springSecurityFilterChain");
FilterRegistration.Dynamic idpSpringSecurityFilterChainReg =
servletContext.addFilter("idpSpringSecurityFilterChain", idpSpringSecurityFilterChain);
idpSpringSecurityFilterChainReg.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "/idp/*");
}
示例3: getServletFilters
import org.springframework.web.filter.DelegatingFilterProxy; //导入方法依赖的package包/类
@Override
protected Filter[] getServletFilters() {
DelegatingFilterProxy filter = new DelegatingFilterProxy("securitySwitchFilter");
filter.setContextAttribute("org.springframework.web.servlet.FrameworkServlet.CONTEXT.dispatcher");
filter.setTargetFilterLifecycle(true);
return new Filter[] { filter, new DelegatingFilterProxy("dawgCorsFilter"), new DelegatingFilterProxy("logFilter") };
}
示例4: getServletFilters
import org.springframework.web.filter.DelegatingFilterProxy; //导入方法依赖的package包/类
@Override
protected Filter[] getServletFilters() {
DelegatingFilterProxy filter = new DelegatingFilterProxy("securitySwitchFilter");
filter.setContextAttribute("org.springframework.web.servlet.FrameworkServlet.CONTEXT.dispatcher");
filter.setTargetFilterLifecycle(true);
return new Filter[] { filter, new DelegatingFilterProxy("dawgCorsFilter"), new DelegatingFilterProxy("logFilter")};
}
示例5: init
import org.springframework.web.filter.DelegatingFilterProxy; //导入方法依赖的package包/类
/**
* Initialize the wrapped security filter here
* @param filterConfig the configuration of filters
*/
@Override
public void init(FilterConfig filterConfig) throws ServletException {
securityFilter = new DelegatingFilterProxy("springSecurityFilterChain");
securityFilter.setContextAttribute("org.springframework.web.servlet.FrameworkServlet.CONTEXT.dispatcher");
securityFilter.init(filterConfig);
}
示例6: getServletFilters
import org.springframework.web.filter.DelegatingFilterProxy; //导入方法依赖的package包/类
@Override
protected Filter[] getServletFilters() {
DelegatingFilterProxy filter = new DelegatingFilterProxy("securitySwitchFilter");
filter.setContextAttribute("org.springframework.web.servlet.FrameworkServlet.CONTEXT.dispatcher");
filter.setTargetFilterLifecycle(true);
return new Filter[] { filter, new DelegatingFilterProxy("logFilter") };
}
示例7: onStartup
import org.springframework.web.filter.DelegatingFilterProxy; //导入方法依赖的package包/类
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
super.onStartup(servletContext);
DelegatingFilterProxy filter = new DelegatingFilterProxy("springSecurityFilterChain");
filter.setContextAttribute("org.springframework.web.servlet.FrameworkServlet.CONTEXT.dispatcher");
servletContext.addFilter("springSecurityFilterChain", filter).addMappingForUrlPatterns(null, false, "/*");
}
示例8: insertSessionRepositoryFilter
import org.springframework.web.filter.DelegatingFilterProxy; //导入方法依赖的package包/类
/**
* Registers the springSessionRepositoryFilter.
* @param servletContext the {@link ServletContext}
*/
private void insertSessionRepositoryFilter(ServletContext servletContext) {
String filterName = DEFAULT_FILTER_NAME;
DelegatingFilterProxy springSessionRepositoryFilter = new DelegatingFilterProxy(
filterName);
String contextAttribute = getWebApplicationContextAttribute();
if (contextAttribute != null) {
springSessionRepositoryFilter.setContextAttribute(contextAttribute);
}
registerFilter(servletContext, true, filterName, springSessionRepositoryFilter);
}
开发者ID:spring-projects,项目名称:spring-session,代码行数:15,代码来源:AbstractHttpSessionApplicationInitializer.java
示例9: registerProxyFilter
import org.springframework.web.filter.DelegatingFilterProxy; //导入方法依赖的package包/类
private void registerProxyFilter(ServletContext servletContext, String name) {
DelegatingFilterProxy filter = new DelegatingFilterProxy(name);
filter.setContextAttribute("org.springframework.web.servlet.FrameworkServlet.CONTEXT.dispatcher");
servletContext.addFilter(name, filter).addMappingForUrlPatterns(null, false, "/*");
}
示例10: registerProxyFilter
import org.springframework.web.filter.DelegatingFilterProxy; //导入方法依赖的package包/类
private void registerProxyFilter(ServletContext servletContext, String name) {
DelegatingFilterProxy filter = new DelegatingFilterProxy(name);
filter.setContextAttribute("org.springframework.web.servlet.FrameworkServlet.CONTEXT.dispatcher");
servletContext.addFilter(name, filter).addMappingForUrlPatterns(null, false, "/*");
}