UrlRewrite - query string outbound rule not working.

480 views
Skip to first unread message

Jagdish

unread,
Mar 29, 2012, 2:54:38 PM3/29/12
to UrlRewrite
I really appreciate any help to spot what am i doing wrong .... i am
really not sure why outbound rule is not working. my application is
hosted on google app engine (gae/j) and i am using Tuckey
urlRewriteFilter (ver 3.2.0).

my outbound rule in urlrewrite.xml is -

<outbound-rule>
<from>^view.jsp\?id=([a-zA-Z]+)&amp;title=([a-zA-Z]+)$</from>
<to>view/$1/$2</to>
</outbound-rule>

and I am trying to invoke in JSP as below -

<a href="<%= response.encodeURL("/view.jsp?id="+id+"&amp;title="+title)
%>">

when i click on URL - i get -> /view.jsp;jsessionid=d18wgox9o7zy?
id=7&title=test

I want to get -> /view/7/test

not sure why my outbound rule is not working and also how to get rid
of that jsessionid?

my web.xml has following -

<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-
class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-
class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>

Avlesh Singh

unread,
Mar 29, 2012, 3:10:37 PM3/29/12
to urlre...@googlegroups.com
See if you can get any cues from this thread - http://code.google.com/p/urlrewritefilter/issues/detail?id=55 

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+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/urlrewrite?hl=en.


Jagdish

unread,
Mar 29, 2012, 4:23:14 PM3/29/12
to urlre...@googlegroups.com
Hello Avlesh,

thank you for response, i see that thread is suggesting to create full path .. so i updated my JSP as below.

<a href="<%=request.getContextPath()%><%= response.encodeURL("/view.jsp?id="+id+"&amp;title="+title)%>"><%=question.getTitle()%>

but i still see my url getting generated as .. /view.jsp;jsessionid=d18wgox9o7zy?id=7&title=test

so not really sure why my getContextPath is returning blank string .. so I did hardcode my servername .. but i still see the same issue, I tried following -

<a href="http://mywebsite.com<%= response.encodeURL("/view.jsp?id="+id+"&amp;title="+title)%>"><%=question.getTitle()%> 

my url getting generated as .. http://mywebsite/com/view.jsp;jsessionid=d18wgox9o7zy?id=7&title=test 

any idea if i misunderstood the fix or something else is missing.

Thank you so much,

Jagdish
To unsubscribe from this group, send email to urlrewrite+unsubscribe@googlegroups.com.

Wim De Smet

unread,
Mar 30, 2012, 9:22:04 AM3/30/12
to urlre...@googlegroups.com
Hi,

On Thu, Mar 29, 2012 at 8:54 PM, Jagdish <jagd...@gmail.com> wrote:
> I really appreciate any help to spot what am i doing wrong .... i am
> really not sure why outbound rule is not working. my application is
> hosted on google app engine (gae/j) and i am using  Tuckey
> urlRewriteFilter (ver 3.2.0).
>
> my outbound rule in urlrewrite.xml is -
>
>    <outbound-rule>
>        <from>^view.jsp\?id=([a-zA-Z]+)&amp;title=([a-zA-Z]+)$</from>
>        <to>view/$1/$2</to>
>    </outbound-rule>

Can you try dropping the first anchor (^) in your from? Seems to me
that the URL will at least include a '/' in the beginning.

regards,
Wim

Reply all
Reply to author
Forward
0 new messages