|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2017 the original author or authors. |
|
|
|
* Copyright 2002-2021 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -54,9 +54,9 @@ import org.springframework.web.context.support.WebApplicationContextUtils; |
|
|
|
* of the {@code Filter.init} and {@code Filter.destroy} lifecycle methods |
|
|
|
* of the {@code Filter.init} and {@code Filter.destroy} lifecycle methods |
|
|
|
* on the target bean, letting the servlet container manage the filter lifecycle. |
|
|
|
* on the target bean, letting the servlet container manage the filter lifecycle. |
|
|
|
* |
|
|
|
* |
|
|
|
* <p>As of Spring 3.1, {@code DelegatingFilterProxy} has been updated to optionally accept |
|
|
|
* <p>As of Spring 3.1, {@code DelegatingFilterProxy} has been updated to optionally |
|
|
|
* constructor parameters when using Servlet 3.0's instance-based filter registration |
|
|
|
* accept constructor parameters when using a Servlet container's instance-based filter |
|
|
|
* methods, usually in conjunction with Spring 3.1's |
|
|
|
* registration methods, usually in conjunction with Spring's |
|
|
|
* {@link org.springframework.web.WebApplicationInitializer} SPI. These constructors allow |
|
|
|
* {@link org.springframework.web.WebApplicationInitializer} SPI. These constructors allow |
|
|
|
* for providing the delegate Filter bean directly, or providing the application context |
|
|
|
* for providing the delegate Filter bean directly, or providing the application context |
|
|
|
* and bean name to fetch, avoiding the need to look up the application context from the |
|
|
|
* and bean name to fetch, avoiding the need to look up the application context from the |
|
|
|
@ -100,8 +100,7 @@ public class DelegatingFilterProxy extends GenericFilterBean { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Create a new {@code DelegatingFilterProxy}. For traditional (pre-Servlet 3.0) use |
|
|
|
* Create a new {@code DelegatingFilterProxy}. For traditional use in {@code web.xml}. |
|
|
|
* in {@code web.xml}. |
|
|
|
|
|
|
|
* @see #setTargetBeanName(String) |
|
|
|
* @see #setTargetBeanName(String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public DelegatingFilterProxy() { |
|
|
|
public DelegatingFilterProxy() { |
|
|
|
@ -111,8 +110,7 @@ public class DelegatingFilterProxy extends GenericFilterBean { |
|
|
|
* Create a new {@code DelegatingFilterProxy} with the given {@link Filter} delegate. |
|
|
|
* Create a new {@code DelegatingFilterProxy} with the given {@link Filter} delegate. |
|
|
|
* Bypasses entirely the need for interacting with a Spring application context, |
|
|
|
* Bypasses entirely the need for interacting with a Spring application context, |
|
|
|
* specifying the {@linkplain #setTargetBeanName target bean name}, etc. |
|
|
|
* specifying the {@linkplain #setTargetBeanName target bean name}, etc. |
|
|
|
* <p>For use in Servlet 3.0+ environments where instance-based registration of |
|
|
|
* <p>For use with instance-based registration of filters. |
|
|
|
* filters is supported. |
|
|
|
|
|
|
|
* @param delegate the {@code Filter} instance that this proxy will delegate to and |
|
|
|
* @param delegate the {@code Filter} instance that this proxy will delegate to and |
|
|
|
* manage the lifecycle for (must not be {@code null}). |
|
|
|
* manage the lifecycle for (must not be {@code null}). |
|
|
|
* @see #doFilter(ServletRequest, ServletResponse, FilterChain) |
|
|
|
* @see #doFilter(ServletRequest, ServletResponse, FilterChain) |
|
|
|
@ -130,9 +128,8 @@ public class DelegatingFilterProxy extends GenericFilterBean { |
|
|
|
* bean from the Spring {@code WebApplicationContext} found in the {@code ServletContext} |
|
|
|
* bean from the Spring {@code WebApplicationContext} found in the {@code ServletContext} |
|
|
|
* (either the 'root' application context or the context named by |
|
|
|
* (either the 'root' application context or the context named by |
|
|
|
* {@link #setContextAttribute}). |
|
|
|
* {@link #setContextAttribute}). |
|
|
|
* <p>For use in Servlet 3.0+ environments where instance-based registration of |
|
|
|
* <p>For use with instance-based registration of filters. |
|
|
|
* filters is supported. |
|
|
|
* <p>The target bean must implement the standard Servlet Filter interface. |
|
|
|
* <p>The target bean must implement the standard Servlet Filter. |
|
|
|
|
|
|
|
* @param targetBeanName name of the target filter bean to look up in the Spring |
|
|
|
* @param targetBeanName name of the target filter bean to look up in the Spring |
|
|
|
* application context (must not be {@code null}). |
|
|
|
* application context (must not be {@code null}). |
|
|
|
* @see #findWebApplicationContext() |
|
|
|
* @see #findWebApplicationContext() |
|
|
|
@ -145,8 +142,7 @@ public class DelegatingFilterProxy extends GenericFilterBean { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Create a new {@code DelegatingFilterProxy} that will retrieve the named target |
|
|
|
* Create a new {@code DelegatingFilterProxy} that will retrieve the named target |
|
|
|
* bean from the given Spring {@code WebApplicationContext}. |
|
|
|
* bean from the given Spring {@code WebApplicationContext}. |
|
|
|
* <p>For use in Servlet 3.0+ environments where instance-based registration of |
|
|
|
* <p>For use with instance-based registration of filters. |
|
|
|
* filters is supported. |
|
|
|
|
|
|
|
* <p>The target bean must implement the standard Servlet Filter interface. |
|
|
|
* <p>The target bean must implement the standard Servlet Filter interface. |
|
|
|
* <p>The given {@code WebApplicationContext} may or may not be refreshed when passed |
|
|
|
* <p>The given {@code WebApplicationContext} may or may not be refreshed when passed |
|
|
|
* in. If it has not, and if the context implements {@link ConfigurableApplicationContext}, |
|
|
|
* in. If it has not, and if the context implements {@link ConfigurableApplicationContext}, |
|
|
|
|