You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That one cost me countless hours, but I finally figured it out. Sadly, my first post is entirely wrong, but at that time I didn't know better. I have a rule with three parameters /{sort}/{page}/{tags}, each has to match a certain pattern. The sort parameter had to match (a|b|c) (three ways of sorting items in my app). In Rewrite 1.1.0, the forward worked fine, but tags ended up having the value of page while sort and page both had the sorting value (e.g. a). The original tag value was missing. So I updated to Rewrite 2.0.12 and the same rule didn't even forward anymore, but instead gave me a 404 error. Playing around with the order of the where clauses and the number of matches constraints, I found working combinations that lead me to the assumption that no more than one matches clause was possible in the current Rewrite release. As it turned out, my regular expression was causing the error.
tl;dr
A regular expression like (a|b|c) does not work. Use a|b|c instead. That might still be a bug, but it's far less serious. Sorry for my incorrect first post.
DhyanB
changed the title
.addRule(Join.path().to()).where().matches().where().matches() does not work
Problem with regular expression in matches() constraint
Aug 15, 2014
Hey @DhyanB - Thanks for the update. I'm wondering why this would be the case, I'll need to play around with groups and see if I can reproduce something like this. I'm going to leave this open issue until I do.
Also, I'm sorry for not being able to try your example sooner. It's been a crazy few weeks.
Update: See second post for solution.
I'm using Rewrite 2.0.12. Tomcat gives me a 404 error for the following rule:
.addRule(Join.path("/page/{x}/{y}/").to("/foo/page.html")).where("x").matches(pattern).where("y").matches(pattern)
However, this one works fine:
.addRule(Join.path("/page/{x}/").to("/foo/page.html")).where("x").matches(pattern)
Lincoln asked me to test with no matches() constraints and we found out that
.addRule(Join.path("/page/{x}/{y}/").to("/foo/page.html")).where("x").where("y")
works, too. Basically, it seems to work as long as there is only one matches() constraint present. Hence these ones also work:
.addRule(Join.path("/page/{x}/{y}/").to("/foo/page.html")).where("x").matches(pattern).where("y")
.addRule(Join.path("/page/{x}/{y}/{z}").to("/foo/page.html")).where("x").matches(pattern).where("y").where("z")
Chaining multiple
where(x).matches(pattern)
constraints used to work in Rewrite 1.1.0.The text was updated successfully, but these errors were encountered: