tomcat-users mailing list archives

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

----- Original Message ----- 
From: "Pid" <>
To: "Tomcat Users List" <>
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 


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message