* as the WebMethod to extract an URL from.
* @return the corresponding {@link FilterGroup}
*/
public FilterGroup getFilterGroup(Method webMethod) {
Set<Method> urlPatternMatches = new HashSet<Method>();
@SuppressWarnings("unchecked")
Automaton prefixedURLPattern = concatenateWithSlash(
getURLPatternAutomaton((Class<? extends WebApp>) webMethod
.getDeclaringClass()),
getURLPatternAutomaton(webMethod));
// for each webmethod in the webapps, check if it could be hit by the
// possible url patterns
for (Entry<Class<? extends WebApp>, RequestManager> entry : managers
.entrySet()) {
for (RegisteredMethod registeredMethod : entry.getValue()
.getWebMethods()) {
final Method possibleTargetedMethod = registeredMethod
.getMethod();
if (!webMethod.equals(possibleTargetedMethod)) {
Automaton prefixedPossibleTarget = concatenateWithSlash(
getURLPatternAutomaton(entry.getKey()),
getURLPatternAutomaton(possibleTargetedMethod));
final boolean intersects = !prefixedURLPattern
.intersection(prefixedPossibleTarget).isEmpty();
if (intersects)