On 14/09/2009 03:05, WILLIAMer wrote:
I think look up the url in database is not a Immediately way to me.
Because most of item not have the "/" char in name.
My original url would like http://myDomain/getItemPage?itemName=xxx
After the url rewrite rule, url become http://myDomain/item_xxx.html
If the item name like "abc/def", http://myDomain/item_abc/def.html will get
error.
Because tomcat explain there is a directory named item_abc.
I think the tomcat is right.
Tomcat won't do that. The behaviour you describe is the action of the
default servlet.
I recommend that you familiarise yourself with the Servlet Spec and the
properties of the HttpServletRequest and HttpServletResponse objects.
If you configure a servlet Filter then you can examine the full path and
act on it as needed.
Very simple e.g.
String rUri = hreq.getRequestURI();
// rUri = /item_abc/def.html
String item = rUri.replaceAll("\\/item_([\\w\\/]+)\\.html", "$1");
// item = abc/def
then you can skip the redirect step, your Filter would just need to
contain the same code as the servlet doing the existing work.
p
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org