Spring Framework DelegatingFilterProxy - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework DelegatingFilterProxy class.

This code example shows how to use the following methods:setContextAttribute
	} 
	 
	@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, "/*"); 
	} 
	 
} 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setContextAttribute
		registerProxyFilter(servletContext, "springSecurityFilterChain"); 
		registerProxyFilter(servletContext, "oauth2ClientContextFilter"); 
	} 
 
	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, "/*"); 
	} 
 
} 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
  /** 
   * Initializes Spring Security. 
   */ 
  private void initSpringSecurity(ServletContext servletContext, EnumSet<DispatcherType> disps) { 
    log.debug("Registering Spring Security Filter"); 
    FilterRegistration.Dynamic springSecurityFilter = servletContext.addFilter("springSecurityFilterChain", new DelegatingFilterProxy()); 
 
    springSecurityFilter.addMappingForUrlPatterns(disps, false, "/*"); 
  } 
 
  @Override 
  public void contextDestroyed(ServletContextEvent sce) { 
    log.info("Destroying Web application"); 
    WebApplicationContext ac = WebApplicationContextUtils.getRequiredWebApplicationContext(sce.getServletContext()); 
    AnnotationConfigWebApplicationContext gwac = (AnnotationConfigWebApplicationContext) ac; 
    gwac.close(); 
    log.debug("Web application destroyed"); 
  } 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
  /** 
   * Initializes Spring Security. 
   */ 
  private void initSpringSecurity(ServletContext servletContext, EnumSet<DispatcherType> disps) { 
    log.debug("Registering Spring Security Filter"); 
    FilterRegistration.Dynamic springSecurityFilter = servletContext.addFilter("springSecurityFilterChain", new DelegatingFilterProxy()); 
 
    springSecurityFilter.addMappingForUrlPatterns(disps, false, "/*"); 
  } 
 
  @Override 
  public void contextDestroyed(ServletContextEvent sce) { 
    log.info("Destroying Web application"); 
    WebApplicationContext ac = WebApplicationContextUtils.getRequiredWebApplicationContext(sce.getServletContext()); 
    AnnotationConfigWebApplicationContext gwac = (AnnotationConfigWebApplicationContext) ac; 
    gwac.close(); 
    log.debug("Web application destroyed"); 
  } 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
  /** 
   * Initializes Spring Security. 
   */ 
  private void initSpringSecurity(ServletContext servletContext, EnumSet<DispatcherType> disps) { 
    log.debug("Registering Spring Security Filter"); 
    FilterRegistration.Dynamic springSecurityFilter = servletContext.addFilter("springSecurityFilterChain", new DelegatingFilterProxy()); 
 
    springSecurityFilter.addMappingForUrlPatterns(disps, false, "/*"); 
    springSecurityFilter.setAsyncSupported(true); 
  } 
 
  @Override 
  public void contextDestroyed(ServletContextEvent sce) { 
    log.info("Destroying Web application"); 
    WebApplicationContext ac = WebApplicationContextUtils.getRequiredWebApplicationContext(sce.getServletContext()); 
    AnnotationConfigWebApplicationContext gwac = (AnnotationConfigWebApplicationContext) ac; 
    gwac.close(); 
    log.debug("Web application destroyed"); 
  } 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 * A filter delegating requests when the Spring security profile is "secure". 
 * @author noak 
 * @since 2.3.0 
 * 
 */ 
public class BooleanDelegatingFilterProxy extends DelegatingFilterProxy { 
 
	@Override 
	public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain filterChain) 
				throws ServletException, IOException { 
		final String springSecurityProfile = System.getenv(SecurityConstants.SPRING_ACTIVE_PROFILE_ENV_VAR); 
 
	    if (SecurityConstants.SPRING_PROFILE_SECURE.contains(springSecurityProfile)) { 
	    	// Call the delegate 
		      super.doFilter(request, response, filterChain); 
	    } else { 
	    	// Ignore the DelegatingProxyFilter delegate 
	    	filterChain.doFilter(request, response); 
	    } 
	  } 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
@Configuration 
public class WebXmlConfiguration { 
 
    @Bean 
    public Filter springSecurityFilterChain() { 
        return new DelegatingFilterProxy();
    } 
 
    @Bean 
    public ServletRegistrationBean jersey() { 
        Servlet jerseyServlet = new SpringServlet();
        ServletRegistrationBean jerseyServletRegistration = new ServletRegistrationBean();
        jerseyServletRegistration.setServlet(jerseyServlet);
        jerseyServletRegistration.addUrlMappings("/api/v1/*");
        jerseyServletRegistration.setName("jersey-servlet");
        jerseyServletRegistration.setLoadOnStartup(1);
        jerseyServletRegistration.addInitParameter("com.sun.jersey.api.json.POJOMappingFeature", "true");
        jerseyServletRegistration.addInitParameter("com.sun.jersey.spi.container.ContainerResponseFilters",
                ResponseCorsFilter.class.getName());
        jerseyServletRegistration.addInitParameter("com.sun.jersey.config.feature.DisableWADL", "true");
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 
        /* Let super do its thing... */ 
        super.onStartup(servletContext); 
 
        /* Add the Spring Security filter. */ 
        servletContext.addFilter("springSecurityFilterChain", 
                new DelegatingFilterProxy()).addMappingForUrlPatterns(null, 
                false, "/*"); 
 
        // Add metrics servlet. 
        ServletRegistration.Dynamic metricsServlet = servletContext.addServlet( 
                "metrics", AdminServlet.class); 
        metricsServlet.addMapping("/metrics/*"); 
    } 
 
    @Override 
    public void contextInitialized(ServletContextEvent servletContextEvent) { 
        try { 
            onStartup(servletContextEvent.getServletContext()); 
        } catch (ServletException e) { 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
	protected Filter[] getServletFilters() { 
		CharacterEncodingFilter encodingFilter = new CharacterEncodingFilter(); 
		encodingFilter.setEncoding("UTF-8"); 
		encodingFilter.setForceEncoding(true); 
 
		DelegatingFilterProxy reconnectDelegate = new DelegatingFilterProxy("apiExceptionHandler"); 
		 
		return new Filter[] { reconnectDelegate, encodingFilter, new HiddenHttpMethodFilter() }; 
	} 
 
} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
    } 
 
    @Override 
    protected Filter[] getServletFilters() { 
        return new Filter[]{ 
                new DelegatingFilterProxy("springSecurityFilterChain"),  
                new MultipartFilter() 
                }; 
    } 
 
    @Override 
    protected String getServletName() { 
        return "JiwhizWeb"; 
    } 
} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Spring Framework DelegatingFilterProxy Methods: