diff --git a/core/src/main/java/org/springframework/security/util/FilterChainProxy.java b/core/src/main/java/org/springframework/security/util/FilterChainProxy.java index 7711dcb107..432555feff 100644 --- a/core/src/main/java/org/springframework/security/util/FilterChainProxy.java +++ b/core/src/main/java/org/springframework/security/util/FilterChainProxy.java @@ -23,6 +23,7 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.security.intercept.web.*; import org.springframework.util.Assert; +import org.springframework.web.filter.DelegatingFilterProxy; import javax.servlet.*; import java.io.IOException; @@ -35,11 +36,10 @@ import java.util.*; * context unless you need very fine control over the filter chain contents. Most cases should be adequately covered * by the default <security:http /> namespace configuration options. * - *
The FilterChainProxy is loaded via a standard
- * {@link org.springframework.security.util.FilterToBeanProxy} declaration in web.xml.
- * FilterChainProxy will then pass {@link #init(FilterConfig)}, {@link #destroy()} and {@link
- * #doFilter(ServletRequest, ServletResponse, FilterChain)} invocations through to each Filter defined
- * against FilterChainProxy.
The FilterChainProxy is loaded via a standard Spring {@link DelegatingFilterProxy} declaration in
+ * web.xml. FilterChainProxy will then pass {@link #init(FilterConfig)}, {@link #destroy()}
+ * and {@link #doFilter(ServletRequest, ServletResponse, FilterChain)} invocations through to each Filter
+ * defined against FilterChainProxy.
*
*
As of version 2.0, FilterChainProxy is configured using an ordered Map of path patterns to Lists * of Filter objects. In previous @@ -64,26 +64,27 @@ import java.util.*; * application context. The order of the names defines the order in which the filters will be applied. As shown above, * use of the value "none" for the "filters" can be used to exclude * Please consult the security namespace schema file for a full list of available configuration options. - *
* - *+ *
* Each possible URI pattern that FilterChainProxy should service must be entered.
* The first matching URI pattern for a given request will be used to define all of the
* Filters that apply to that request. NB: This means you must put most specific URI patterns at the top
* of the list, and ensure all Filters that should apply for a given URI pattern are entered against the
* respective entry. The FilterChainProxy will not iterate the remainder of the URI patterns to locate
- * additional Filters.
FilterChainProxy respects normal handling of Filters that elect not to call {@link
+ * additional Filters.
+ *
+ *
FilterChainProxy respects normal handling of Filters that elect not to call {@link
* javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse,
* javax.servlet.FilterChain)}, in that the remainder of the original or FilterChainProxy-declared filter
- * chain will not be called.
It is particularly noted the Filter lifecycle mismatch between the servlet container and IoC
- * container. As per {@link org.springframework.security.util.FilterToBeanProxy} JavaDocs, we recommend you allow the IoC
- * container to manage lifecycle instead of the servlet container. By default the FilterToBeanProxy will
- * never call this class' {@link #init(FilterConfig)} and {@link #destroy()} methods, meaning each of the filters
+ * chain will not be called.
+ *
+ *
It is particularly noted the Filter lifecycle mismatch between the servlet container and IoC
+ * container. As per {@link DelegatingFilterProxy} JavaDocs, we recommend you allow the IoC
+ * container to manage lifecycle instead of the servlet container. By default the DelegatingFilterProxy
+ * will never call this class' {@link #init(FilterConfig)} and {@link #destroy()} methods, meaning each of the filters
* defined in the filter chain map will not be called. If you do need your filters to be
* initialized and destroyed, please set the lifecycle initialization parameter against the
- * FilterToBeanProxy to specify servlet container lifecycle management.
DelegatingFilterProxy to specify servlet container lifecycle management.
*
* @author Carlos Sanchez
* @author Ben Alex
@@ -191,7 +192,7 @@ public class FilterChainProxy implements Filter, InitializingBean, ApplicationCo
logger.debug("Converted URL to lowercase, from: '" + url + "'; to: '" + url + "'");
}
}
-
+
boolean matched = matcher.pathMatchesUrl(path, url);
if (logger.isDebugEnabled()) {
@@ -317,6 +318,17 @@ public class FilterChainProxy implements Filter, InitializingBean, ApplicationCo
return matcher;
}
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append("FilterChainProxy[");
+ sb.append(" UrlMatcher = ").append(matcher);
+ sb.append("; Filter Chains: ");
+ sb.append(uncompiledFilterChainMap);
+ sb.append("]");
+
+ return sb.toString();
+ }
+
//~ Inner Classes ==================================================================================================
/**