From 82ed7253d49a55bcd903cb00ab8ed566c16e288f Mon Sep 17 00:00:00 2001
From: Ben Alex FilterInvocationDefinitionSource
.
*
+ * Public visiblity so that tablibs or other view helper classes can access
+ * the ConfigAttributeDefinition
applying to a given URI
+ * pattern without needing to construct a mock
+ * FilterInvocation
and retrieving the attibutes via the
+ * {@link #getAttributes(Object)} method.
+ *
ConfigAttributeDefinition
that applies to the
* specified FilterInvocation
*/
- protected abstract ConfigAttributeDefinition lookupAttributes(
- FilterInvocation filterInvocation);
+ public abstract ConfigAttributeDefinition lookupAttributes(String url);
+
+ public boolean supports(Class clazz) {
+ if (FilterInvocation.class.isAssignableFrom(clazz)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
}
diff --git a/core/src/main/java/org/acegisecurity/intercept/web/PathBasedFilterInvocationDefinitionMap.java b/core/src/main/java/org/acegisecurity/intercept/web/PathBasedFilterInvocationDefinitionMap.java
index e26d604175..e9959e9582 100644
--- a/core/src/main/java/org/acegisecurity/intercept/web/PathBasedFilterInvocationDefinitionMap.java
+++ b/core/src/main/java/org/acegisecurity/intercept/web/PathBasedFilterInvocationDefinitionMap.java
@@ -99,18 +99,15 @@ public class PathBasedFilterInvocationDefinitionMap
}
}
- protected ConfigAttributeDefinition lookupAttributes(
- FilterInvocation filterInvocation) {
+ public ConfigAttributeDefinition lookupAttributes(String url) {
Iterator iter = requestMap.iterator();
- String url = filterInvocation.getRequestUrl();
-
if (convertUrlToLowercaseBeforeComparison) {
url = url.toLowerCase();
if (logger.isDebugEnabled()) {
- logger.debug("Converted URL to lowercase, from: '"
- + filterInvocation.getRequest() + "'; to: '" + url + "'");
+ logger.debug("Converted URL to lowercase, from: '" + url
+ + "'; to: '" + url + "'");
}
}
diff --git a/core/src/main/java/org/acegisecurity/intercept/web/RegExpBasedFilterInvocationDefinitionMap.java b/core/src/main/java/org/acegisecurity/intercept/web/RegExpBasedFilterInvocationDefinitionMap.java
index 801870b523..73d0c344b1 100644
--- a/core/src/main/java/org/acegisecurity/intercept/web/RegExpBasedFilterInvocationDefinitionMap.java
+++ b/core/src/main/java/org/acegisecurity/intercept/web/RegExpBasedFilterInvocationDefinitionMap.java
@@ -117,20 +117,17 @@ public class RegExpBasedFilterInvocationDefinitionMap
}
}
- protected ConfigAttributeDefinition lookupAttributes(
- FilterInvocation filterInvocation) {
+ public ConfigAttributeDefinition lookupAttributes(String url) {
PatternMatcher matcher = new Perl5Matcher();
Iterator iter = requestMap.iterator();
- String url = filterInvocation.getRequestUrl();
-
if (convertUrlToLowercaseBeforeComparison) {
url = url.toLowerCase();
if (logger.isDebugEnabled()) {
- logger.debug("Converted URL to lowercase, from: '"
- + filterInvocation.getRequest() + "'; to: '" + url + "'");
+ logger.debug("Converted URL to lowercase, from: '" + url
+ + "'; to: '" + url + "'");
}
}
diff --git a/core/src/test/java/org/acegisecurity/intercept/web/MockFilterInvocationDefinitionSource.java b/core/src/test/java/org/acegisecurity/intercept/web/MockFilterInvocationDefinitionSource.java
index 2d0372eea7..414661170b 100644
--- a/core/src/test/java/org/acegisecurity/intercept/web/MockFilterInvocationDefinitionSource.java
+++ b/core/src/test/java/org/acegisecurity/intercept/web/MockFilterInvocationDefinitionSource.java
@@ -81,8 +81,7 @@ public class MockFilterInvocationDefinitionSource
}
}
- protected ConfigAttributeDefinition lookupAttributes(
- FilterInvocation filterInvocation) {
+ public ConfigAttributeDefinition lookupAttributes(String url) {
throw new UnsupportedOperationException("mock method not implemented");
}
}
diff --git a/core/src/test/java/org/acegisecurity/intercept/web/PathBasedFilterDefinitionMapTests.java b/core/src/test/java/org/acegisecurity/intercept/web/PathBasedFilterDefinitionMapTests.java
index 3ca571a7e1..b4de8f40c2 100644
--- a/core/src/test/java/org/acegisecurity/intercept/web/PathBasedFilterDefinitionMapTests.java
+++ b/core/src/test/java/org/acegisecurity/intercept/web/PathBasedFilterDefinitionMapTests.java
@@ -79,7 +79,8 @@ public class PathBasedFilterDefinitionMapTests extends TestCase {
FilterInvocation fi = new FilterInvocation(req,
new MockHttpServletResponse(), new MockFilterChain());
- ConfigAttributeDefinition response = map.lookupAttributes(fi);
+ ConfigAttributeDefinition response = map.lookupAttributes(fi
+ .getRequestUrl());
assertEquals(def, response);
}
@@ -98,7 +99,8 @@ public class PathBasedFilterDefinitionMapTests extends TestCase {
FilterInvocation fi = new FilterInvocation(req,
new MockHttpServletResponse(), new MockFilterChain());
- ConfigAttributeDefinition response = map.lookupAttributes(fi);
+ ConfigAttributeDefinition response = map.lookupAttributes(fi
+ .getRequestUrl());
assertEquals(null, response);
}
@@ -117,7 +119,8 @@ public class PathBasedFilterDefinitionMapTests extends TestCase {
FilterInvocation fi = new FilterInvocation(req,
new MockHttpServletResponse(), new MockFilterChain());
- ConfigAttributeDefinition response = map.lookupAttributes(fi);
+ ConfigAttributeDefinition response = map.lookupAttributes(fi
+ .getRequestUrl());
assertEquals(def, response);
}
}
diff --git a/core/src/test/java/org/acegisecurity/intercept/web/RegExpBasedFilterDefinitionMapTests.java b/core/src/test/java/org/acegisecurity/intercept/web/RegExpBasedFilterDefinitionMapTests.java
index 3c3c819c3b..7645abf822 100644
--- a/core/src/test/java/org/acegisecurity/intercept/web/RegExpBasedFilterDefinitionMapTests.java
+++ b/core/src/test/java/org/acegisecurity/intercept/web/RegExpBasedFilterDefinitionMapTests.java
@@ -79,7 +79,8 @@ public class RegExpBasedFilterDefinitionMapTests extends TestCase {
FilterInvocation fi = new FilterInvocation(req,
new MockHttpServletResponse(), new MockFilterChain());
- ConfigAttributeDefinition response = map.lookupAttributes(fi);
+ ConfigAttributeDefinition response = map.lookupAttributes(fi
+ .getRequestUrl());
assertEquals(def, response);
}
@@ -98,7 +99,8 @@ public class RegExpBasedFilterDefinitionMapTests extends TestCase {
FilterInvocation fi = new FilterInvocation(req,
new MockHttpServletResponse(), new MockFilterChain());
- ConfigAttributeDefinition response = map.lookupAttributes(fi);
+ ConfigAttributeDefinition response = map.lookupAttributes(fi
+ .getRequestUrl());
assertEquals(null, response);
}
@@ -117,7 +119,8 @@ public class RegExpBasedFilterDefinitionMapTests extends TestCase {
FilterInvocation fi = new FilterInvocation(req,
new MockHttpServletResponse(), new MockFilterChain());
- ConfigAttributeDefinition response = map.lookupAttributes(fi);
+ ConfigAttributeDefinition response = map.lookupAttributes(fi
+ .getRequestUrl());
assertEquals(def, response);
}
}
diff --git a/doc/xdocs/changes.xml b/doc/xdocs/changes.xml
index 1efccf8e2f..7bff6a930f 100644
--- a/doc/xdocs/changes.xml
+++ b/doc/xdocs/changes.xml
@@ -45,6 +45,7 @@