您的位置:寻梦网首页编程乐园Java天地JSP 专辑JSP001 HTML 离线版
Java 天地
JSP001 HTML 离线版
FAQ汇萃 >> Tomcat >> 为什么encodeURL() 在 Apache-Tomcat 一起工作的时候不正常?

由 webmaster 发布于: 2001-01-30 10:14

Talking

To: tomcat-user@jakarta.apache.org
Subject: Re: P: session tracking * encodeURL
From: Jason Rumney <jrumney@ipo.att.com>
Date: 18 May 2000 14:38:58 +0100

Johannes_Lorenz@mn.man.de writes:

> Hello,
>
> i use the methode encodeURL for rewriting URLs. It's working, if i use tomcat
> standalone, but it doesn't work in the apache-tomcat environment.
>
> Has anybody else seen this effect?

The problem is that Apache does not recognize the semicolon that
separates the session id from the rest of the URL as being anything
special, so rules based on file extension for example, won't match
properly.

> Is there a workaround (i won't use cookies)?

I have the following rewrite rule in my apache config to fix this:


<IfModule mod_rewrite.c>
RewriteEngine on
# Force URLs with a jsessionid to go to Tomcat. Necessary because
# Apache doesn't recognise that the semi-colon is special.
RewriteRule ^(/.*;jsessionid=.*)$ $1 [T=jserv-servlet]
</IfModule>


If you access a servlet via the standard-http port 80 (either running tomcat on that port or accessing it through apache) the encodeURL and encodeRedirectURL methods don't work properly in Tomcat 3.1. This is fixed in Tomcat 3.2beta2.



资料来源: JSP001.com