rules stopped working after switching from Java 5 to Java 6

23 views
Skip to first unread message

Fly Steer

unread,
Sep 3, 2010, 3:54:20 PM9/3/10
to UrlRewrite
Hi,

We are planning to switch our webapp from Java 5 to Java 6, and one of
the issues found is that some of the rules stopped working if Java 6
is used:

<rule>
<name>My Rule</name>
<from>^/([\w\\.\_\-\"&amp;&amp;[^\Qdispatch\E^\Qfavicon.ico
\E^\Q.do\E^\Q.pub\E^\Q.html\E^\Qfavicon\E]]{1,40})$
</from>
<to>/somePage.do?id=$1</to>
</rule>

this rule is an example of intersection.
When compiling the code with Java 6, this rule is not triggered for
urls like:
http://www.mysite.com/123456

Please, help what could be wrong?
May be UrlRewriteFilter requires dependent libs of certain versions to
be present in classpath
Turninng on DEBUG logging didn't help - rule is not triggered

Java 6, 64 bit, Linux
Tomcat 5.5.25
UrlRewriteFilter 2.6

MethoD

unread,
Sep 6, 2010, 12:28:50 AM9/6/10
to UrlRewrite
I've also have this issue even tough upgraded to URF 3.2.

btw how can I debug what rule is processing current request?

Wim De Smet

unread,
Sep 6, 2010, 4:06:47 AM9/6/10
to urlre...@googlegroups.com
Hi,

On Fri, Sep 3, 2010 at 9:54 PM, Fly Steer <flys...@gmail.com> wrote:
> Hi,
>
> We are planning to switch our webapp from Java 5 to Java 6, and one of
> the issues found is that some of the rules stopped working if Java 6
> is used:
>
>     <rule>
>            <name>My Rule</name>
>            <from>^/([\w\\.\_\-\"&amp;&amp;[^\Qdispatch\E^\Qfavicon.ico
> \E^\Q.do\E^\Q.pub\E^\Q.html\E^\Qfavicon\E]]{1,40})$
>            </from>
>            <to>/somePage.do?id=$1</to>
>       </rule>
>
> this rule is an example of intersection.
> When compiling the code with Java 6, this rule is not triggered for
> urls like:
> http://www.mysite.com/123456

I tried this with 3.2, it works for me. Whitespace is significant here
so make sure the entire from is on one line!.

BTW, that rule doesn't do what you might think it does. Character
classes only match individual characters, even when you quote the
strings containing them. In your intersection you match d, i, s, p, a,
t, c, h and thus the word dispatch, but you can't match the entire
word all at once, i.e. chtpasid would match too.

regards,
Wim

Fly Steer

unread,
Sep 6, 2010, 6:45:00 PM9/6/10
to UrlRewrite
Thanks!

You are absolutely right. Original rule was written by another
developer, so I had no clear idea what is it about at first.
Then I started searching for intersections in regex, and found that
they work only for character classes, but not with words.
It's strange, but java regex doesn't provide elegant mechanism to
exclude words!
Then I isolated the problem down to one rule and wrote simple java
program that test it.

so, my solution for this:

<from>^/((?!.*\.do.*)(?!.*\.pub.*)(?!.*\.html.*)(?!.*dispatch.*)
(?!.*favicon.ico.*)[\w\\.\_\-\"]+)$</from>

May be it will help someone else struggling with the same issue.
Thanks a lot!
> Wim- Hide quoted text -
>
> - Show quoted text -
Message has been deleted

Fly Steer

unread,
Sep 27, 2016, 1:27:12 PM9/27/16
to urlre...@googlegroups.com
Thanks for reply, but the issue was more with the incorrect logic in
the rule.

On Sep 5, 7:43 pm, Avlesh Singh <avl...@gmail.com> wrote:
> Can I please suggest you to upgrade to URF 3.2?
>
> Cheers
> Avlesh
> > --
> > You received this message because you are subscribed to the Google Groups
> > "UrlRewrite" group.
> > To post to this group, send email to urlre...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > urlrewrite+unsubscribe@googlegroups.com<urlrewrite%2Bunsubscribe@googlegrou­ps.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/urlrewrite?hl=en.- Hide quoted text -
Reply all
Reply to author
Forward
0 new messages