tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mullen-Schultz, Gary" <Gary.MullenSchu...@Kingland.com>
Subject request.getPort() returns wrong port after redirect
Date Tue, 16 Apr 2002 19:39:14 GMT
I am running on Tomcat 4.0.3, using the standalone server.

We do multiple redirects in our server, across Tomcat instances.  We are
encountering failure in the following scenario.

Let's say we have two Tomcat instances: A on port 81, and B on port 82.  A
contains one JSP in the root webapp: SendRedirect.jsp.  B contains two JSPs
in the root webapp: ReceiveAndSendRedirect.jsp and ReceiveRedirect.jsp.  The
source is as follows:

SendRedirect.jsp:
<%
response.sendRedirect("http://127.0.0.1:82//ReceiveAndSendRedirect.jsp");
%>


ReceiveAndSendRedirect.jsp:
<%
response.sendRedirect("ReceiveRedirect.jsp");
%>

ReceiveRedirect.jsp:
<html><body>
This is ReceiveRedirect!
</body></html>

What ends up happening is that the sendRedirect method inside
ReceiveAndSendRedirect.jsp builds a URL that looks like this:
http://127.0.0.1:81//ReceiveRedirect.jsp

There *is* no ReceiveRedirect.jsp on instance A (port 81), and a 404
results.

In debug mode, a call to request.getPort() inside ReceiveAndSendRedirect.jsp
returns 81; given that it's a redirect (not a forward), I would have thought
it would return 82 (the port of the "current" server).

Any ideas?  Am I just confused?  If so, how can I easily do this multiple
redirection (it gets invoked when our security code kicks in).

Thanks, Gary Mullen-Schultz, Kingland Systems



Mime
View raw message