tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zimmerer, Ralf" <>
Subject URL rewriting + RequestDispatcher.forward(...)
Date Mon, 07 May 2001 09:08:23 GMT

our configuration is as follows:

RedHat 6.1
IBM JDK 1.1.8
Apache httpd 1.3 9
Tomcat 3.2.1

Win NT 4.0/Win 98
IBM JDK 1.1.8
Apache httpd 1.3 9
Tomcat 3.2.1

The developed application works fine with cookie browser support,
but without cookie support, we run in one special problem.

We use mod_rewrite in Apache httpd in order to handle URL's like:;jsessionid=7y5yoj91n2?act=start&ste

This works right.

In the Java application we use response.encodeURL(...)
to instruct Tomcat to generate an URL with the current session id.

This method call we use in different JSP-files, but also in
public methods of some JavaBeans, which generates HTML output.

Let's construct the following situation:

We have a method, that construct the following URL:

1.	with cookie support
url_1 =

2.	with URL rewriting
url_2 =;jsessionid=7y5yoj91n2?act=start&ste

When we now use the two constructed url's with the following
method calls, we get different results:

context.getRequestDispatcher(url_1).include(request, response);
	result: O.K., page with url_1 will be included ...

context.getRequestDispatcher(url_1).forward(request, response);
	result: O.K., it will be forwarded to the page with url_1

context.getRequestDispatcher(url_2).include(request, response);
	result: O.K., page with url_2 will be included ...

context.getRequestDispatcher(url_2).forward(request, response);

We have now implemented as workaround a method, that looks for a
session id in the path parameter, if a RequestDispatcher.forward(...)
should be processed, and cuts it (;jsessionid=xyz24356).

But this isn't a nice solution !!!

Why doesn't work a forward with an URL with a jsessionid ?

Thanks in advance,
Ralf Zimmerer.

(temporary at Dresdner Bank: Internet Service Agentur

View raw message