Announcement Announcement Module
Collapse
No announcement yet.
RegExpBasedFilterInvocationDefinitionMap & Wildcards Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • RegExpBasedFilterInvocationDefinitionMap & Wildcards

    In the method public ConfigAttributeDefinition lookupAttributes(String url), Acegi looks the ConfigAttributeDefinition using Perl5Matcher:

    boolean matched = matcher.matches(url, entryHolder.getCompiledPattern());

    But the method 'matches' in Perl5Matcher 'determines if a string exactly matches a given pattern', so no wildcards can be used.

    Shouldn't be better to use the method 'contains' instead?

    Anyway, how can be wildcards defined?

  • #2
    Quoting the Contacts Sample Application's applicationContext-acegi-security.xml:

    <!-- BASIC Regular Expression Syntax (for beginners):

    \A means the start of the string (ie the beginning of the URL)
    \Z means the end of the string (ie the end of the URL)
    . means any single character
    * means null or any number of repetitions of the last expression (so .* means zero or more characters)

    Some examples:

    Expression: \A/my/directory/.*\Z
    Would match: /my/directory/
    /my/directory/hello.html

    Expression: \A/.*\Z
    Would match: /hello.html
    /

    Expression: \A/.*/secret.html\Z
    Would match: /some/directory/secret.html
    /another/secret.html
    Not match: /anothersecret.html (missing required /)
    -->
    As such .* will match any character.

    Most people prefer to use the Ant Path syntax. See http://acegisecurity.sourceforge.net...lterinvocation for more info.

    Comment

    Working...
    X