You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Zimmerer, Ralf" <Ra...@Dresdner-Bank.com> on 2001/05/07 11:08:23 UTC

URL rewriting + RequestDispatcher.forward(...)

Hello,

our configuration is as follows:

Production:
------------------------
RedHat 6.1
IBM JDK 1.1.8
Apache httpd 1.3 9
Tomcat 3.2.1

Development:
------------------------
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:

http://www.domain.com/shop/cashstyle.jsp;jsessionid=7y5yoj91n2?act=start&ste
p=1

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 = http://www.domain.com/shop/cashstyle.jsp?act=start&step=1

2.	with URL rewriting
url_2 =
http://www.domain.com/shop/cashstyle.jsp;jsessionid=7y5yoj91n2?act=start&ste
p=1


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);
	result: FAILED, NO FORWARDING !!!


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 !!!

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


Thanks in advance,
Ralf Zimmerer.

(temporary at Dresdner Bank: ralf.zimmerer@dresdner-bank.com)

NINA.de Internet Service Agentur
http://www.nina.de/
http://www.liveshop.de/