Java Code Examples for org.springframework.web.filter.DelegatingFilterProxy#setTargetFilterLifecycle()

The following examples show how to use org.springframework.web.filter.DelegatingFilterProxy#setTargetFilterLifecycle() . 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: ShiroConfig.java    From erp-framework with MIT License 6 votes vote down vote up
/**
     * 自动创建代理
     * @return
     */
//    @Bean
//    @DependsOn({"lifecycleBeanPostProcessor"})
//    public DefaultAdvisorAutoProxyCreator advisorAutoProxyCreator(){
//        DefaultAdvisorAutoProxyCreator advisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
//        advisorAutoProxyCreator.setProxyTargetClass(true);
//        return advisorAutoProxyCreator;
//    }

    @Bean
    public FilterRegistrationBean delegatingFilterProxy(){
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
        DelegatingFilterProxy proxy = new DelegatingFilterProxy();
        proxy.setTargetFilterLifecycle(true);
        proxy.setTargetBeanName("shiroFilter");
        filterRegistrationBean.setFilter(proxy);
        filterRegistrationBean.setDispatcherTypes(DispatcherType.ERROR,DispatcherType.REQUEST,DispatcherType.FORWARD,DispatcherType.INCLUDE);
        return filterRegistrationBean;
    }
 
Example 2
Source File: CentralizeInitializer.java    From java-platform with Apache License 2.0 6 votes vote down vote up
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
	Map<String, String> filterChainDefinitionMap = Application.getSecurityFilterChainDefinitionMap();
	filterChainDefinitionMap.put("/admin", DefaultFilter.authc.name());
	filterChainDefinitionMap.put("/admin/logout", DefaultFilter.logout.name());
	filterChainDefinitionMap.put("/admin/**", DefaultFilter.authc.name());

	List<Filter> filters = Application.getFilters();

	DelegatingFilterProxy shiroFilter = new DelegatingFilterProxy("shiroFilter");
	shiroFilter.setTargetFilterLifecycle(true);
	filters.add(shiroFilter);

	filters.add(new RequestContextFilter());
	filters.add(new CharacterEncodingFilter("UTF-8", true));
}
 
Example 3
Source File: ShiroConfig.java    From spring-boot-plus with Apache License 2.0 5 votes vote down vote up
/**
 * ShiroFilter配置
 *
 * @return
 */
@Bean
public FilterRegistrationBean delegatingFilterProxy() {
    FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
    DelegatingFilterProxy proxy = new DelegatingFilterProxy();
    proxy.setTargetFilterLifecycle(true);
    proxy.setTargetBeanName(SHIRO_FILTER_NAME);
    filterRegistrationBean.setFilter(proxy);
    filterRegistrationBean.setAsyncSupported(true);
    filterRegistrationBean.setEnabled(true);
    filterRegistrationBean.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.ASYNC);
    return filterRegistrationBean;
}
 
Example 4
Source File: ShiroConfig.java    From mysiteforme with Apache License 2.0 5 votes vote down vote up
@Bean
public FilterRegistrationBean delegatingFilterProxy(){
    FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
    DelegatingFilterProxy proxy = new DelegatingFilterProxy();
    proxy.setTargetFilterLifecycle(true);
    proxy.setTargetBeanName("shiroFilter");
    filterRegistrationBean.setFilter(proxy);
    filterRegistrationBean.setDispatcherTypes(DispatcherType.ERROR,DispatcherType.REQUEST,DispatcherType.FORWARD,DispatcherType.INCLUDE);
    return filterRegistrationBean;
}
 
Example 5
Source File: ShiroConfiguration.java    From easyweb with Apache License 2.0 5 votes vote down vote up
@Bean
public FilterRegistrationBean delegatingFilterProxy() {
    FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
    DelegatingFilterProxy proxy = new DelegatingFilterProxy();
    proxy.setTargetFilterLifecycle(true);
    proxy.setTargetBeanName("shiroFilter");
    filterRegistrationBean.setFilter(proxy);
    return filterRegistrationBean;
}
 
Example 6
Source File: ShiroConfiguration.java    From EasyEE with MIT License 5 votes vote down vote up
/**
 * Shiro Core FilterRegistrationBean: Shiro DelegatingFilterProxy
 * 
 * @return
 */
@Bean 
public FilterRegistrationBean shiroFilterRegistrationBean() {
	FilterRegistrationBean filterRegistration = new FilterRegistrationBean();
	DelegatingFilterProxy delegatingFilterProxy = new DelegatingFilterProxy("shiroFilter");
	delegatingFilterProxy.setTargetFilterLifecycle(true);
	filterRegistration.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.INCLUDE,
			DispatcherType.ERROR);
	filterRegistration.setFilter(delegatingFilterProxy);
	List<String> urlPatterns = new ArrayList<String>();
	urlPatterns.add("/*");
	filterRegistration.setUrlPatterns(urlPatterns);
	return filterRegistration;
}
 
Example 7
Source File: ShiroConfiguration.java    From EasyEE with MIT License 5 votes vote down vote up
/**
 * Shiro Core FilterRegistrationBean: Shiro DelegatingFilterProxy
 * 
 * @return
 */
@Bean 
public FilterRegistrationBean shiroFilterRegistrationBean() {
	FilterRegistrationBean filterRegistration = new FilterRegistrationBean();
	DelegatingFilterProxy delegatingFilterProxy = new DelegatingFilterProxy("shiroFilter");
	delegatingFilterProxy.setTargetFilterLifecycle(true);
	filterRegistration.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.INCLUDE,
			DispatcherType.ERROR);
	filterRegistration.setFilter(delegatingFilterProxy);
	List<String> urlPatterns = new ArrayList<String>();
	urlPatterns.add("/*");
	filterRegistration.setUrlPatterns(urlPatterns);
	return filterRegistration;
}
 
Example 8
Source File: WallRideServletConfiguration.java    From wallride with Apache License 2.0 5 votes vote down vote up
@Bean
public FilterRegistrationBean urlRewriteFilterRegistration() {
	DelegatingFilterProxy proxy = new DelegatingFilterProxy("urlRewriteFilter");
	proxy.setTargetFilterLifecycle(true);

	FilterRegistrationBean registration = new FilterRegistrationBean();
	registration.setName("urlRewriteFilter");
	registration.setFilter(proxy);
	registration.setDispatcherTypes(EnumSet.of(DispatcherType.REQUEST));
	registration.addUrlPatterns("/*");
	registration.setOrder(0);
	return registration;
}