----- Original Message ----- From: "Pid" <p...@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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to