tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From michel <compu...@videotron.ca>
Subject Re: URL Rewrite
Date Sat, 04 Sep 2010 03:30:07 GMT

----- Original Message ----- 
From: "Pid" <pid@pidster.com>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Friday, September 03, 2010 6:29 AM
Subject: Re: URL Rewrite


On 03/09/2010 11:02, michel wrote:
> I have been using the tuckey urlrewrite with some results, in that if I 
> want to have an incoming URL coming in as
>
> gallery/pic20 gets changed to gallery.jsp?pic=20
>
> But the tool bar URL gets displayed as   gallery.jsp?pic=20
>
> and I want to display  gallery/pic20
>
> I tried the '<outbound-rule>', but that didn't have any effect. I also did 
> some reading, and there was some talk about internal and external rewrite, 
> but I have no real clue on how and what to do with that either.

I usually solve this problem by writing a Servlet Filter to parse the
URL and supply the id via a request attribute, to the JSP.

 String pathToJsp = "WEB-INF/jsp/item_page.jsp";
 String id = parseId(request.getRequestURL());

 request.setAttribute("id", id);
 request.getRequestDispatcher(pathToJsp).forward(request, response);


Map the url-pattern for the Filter to /gallery/* and you're set.

--------------------------------------------------------------------------------


Thanks, and I will give that a try next. I first opted for the Tuckey URL 
rewrite since I had first started working with that, but it seems buggy to 
me.


Michel




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message