[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-4190) RewriteFilter is Non-deterministic

John Gilbert (JIRA) jira-events at lists.jboss.org
Fri May 22 15:27:11 EDT 2009

RewriteFilter is Non-deterministic

                 Key: JBSEAM-4190
                 URL: https://jira.jboss.org/jira/browse/JBSEAM-4190
             Project: Seam
          Issue Type: Bug
    Affects Versions: 2.1.1.GA
            Reporter: John Gilbert

The RewriteFilter is non-deterministic in some cases. An example serves best.

Here are the rewrite rules I would like:

/Customer/edit/{id}	-> /jsf/Customer/Edit.xhtml
/Customer/create	-> /jsf/Customer/Edit.xhtml
/Customer/{id}		-> /jsf/Customer/View.xhtml

When debugging the value of RewriteFilter.getAllPatterns(), the order of the two rules for /jsf/Customer/Edit.xhtml are always preserved.

However, because Pages.getKnownViewIds() returns a HashSet there is no guarantee that the rules for /jsf/Customer/View.xhtml will come after the rules for /jsf/Customer/Edit.xhtml.  As a result, /Customer/create sometimes translates to /jsf/Customer/View.xhtml when /jsf/Customer/View.xhtml is returned first in the set.

There are several possible solutions:

1) Change /Customer/{id} to /Customer/view/{id}. However, this is not the best url for a View.
2) Change Pages.pagesByViewId to a TreeMap. This is the patch I am currently using, but it is only guaranteed for my patterns.
3) Change RewriteFilter.getAllPatterns() to returns a TreeSet sorted from longest to shortest. This is similar to the way Pages.wildcardViewIds works.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the seam-issues mailing list