tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Help - Ongoing problem with encodeURL
Date Fri, 22 Sep 2000 17:41:43 GMT
(Please use ASCII mode when sending mail to mailing lists -- not
everyone can correctly interpret HTML mail).

Peter Slade wrote:

> I pulled down tomcat milestone build (3.2 beta 4). My test application
> now shows a session id on the url that it did not show with the 3.1
> version. However I do not understand the url that it generates, and my
> application fails for different reason.
> My output shows that
> response.encodeURL("http://servername/page.jsp?test=true") will
> return
> http://servername/page.jsp;jsessionid=hgdyjjbif1?test=true
> shouldn't it have returned something like
> http://servername/page.jsp?jsessionid=hgdyjjbif1&test=true
> and response.encodeURL("http://servername/page.jsp") will return
> http://servername/page.jsp;jsessionid=hgdyjjbif1
> shouldn't it have returned something like
> http://servername/page.jsp?jsessionid=hgdyjjbif1
> If I put the url that it generates into a browser it will fail with
> 404 Page Not Found.
> Why is the ; character being used instead of a ? character?
> Am I missing something? Is this a bug?
> Pete.

This is not a bug.

The 2.2 version of the servlet specification mandates the name of the
session cookie (JSESSIONID) and the fact that it must be passed as a
*path* parameter (with a semicolon) rather than a query parameter.

For standalone Tomcat, you do not have to do anything other than call
response.encodeURL() for your links -- Tomcat will parse the session id
out of the URL when the user clicks the hyperlink.  If you are running
behind Apache, you have to enable MOD_REWRITE and add a rewrite rule so
that Apache still recognizes the fact that this is a JSP page and
forwards the request to Tomcat for processing.  The details are in the
Tomcat FAQ-O-MATIC (<>) --
search for "URL rewriting".

Craig McClanahan

See you at ApacheCon Europe <>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat

View raw message