Bug 35425 - getRequestURL() no longer works as stated in API
Summary: getRequestURL() no longer works as stated in API
Status: RESOLVED DUPLICATE of bug 28222
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Servlet & JSP API (show other bugs)
Version: 5.5.9
Hardware: Other other
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-20 09:03 UTC by Radoslaw Grzanka
Modified: 2006-07-27 12:27 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Radoslaw Grzanka 2005-06-20 09:03:54 UTC
Hello,
 probably due to fix in bug #28222 (but this is not confirmed) getRequestURL()
doesn't work like described in
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/servletapi/javax/servlet/http/HttpServletRequest.html#getRequestURL()
javadoc page.

This is most visible when using struts. When users request address (i.e.)
http://localhost/struts_action.do (which is purely forward action) requestURL()
used in jsp page where this action forwards returns address of that page
(however address in browser is still struts action). This violates sentence from
api docs that requestURL() "Reconstructs the URL the client used to make the
request."

Above behaviour breaks applications which depend on it.

With Tomcat 5.0.48 requestURL() works correctly.

Radoslaw Grzanka
Comment 1 Remy Maucherat 2005-06-20 10:45:25 UTC

*** This bug has been marked as a duplicate of 28222 ***
Comment 2 Iran Marcius 2005-07-01 21:19:28 UTC
O just installed tomcat 5.5.9 and got the same problem. This hasn't been
corrected in release 5.5.7? I already read the other bug reports and doesn't
seems to me that the bug has been solved, that's because I'm reopening this.

I'll try to analyse the sources to find out some way I can contribute.
Comment 3 Mark Thomas 2005-07-01 21:43:27 UTC
This is a duplicate and will not be changed.
Comment 4 Mark Thomas 2005-07-01 21:43:54 UTC
This is a duplicate and will not be changed.

*** This bug has been marked as a duplicate of 28222 ***

*** This bug has been marked as a duplicate of 28222 ***
Comment 5 Iran Marcius 2005-07-01 22:36:28 UTC
(In reply to comment #4)
> This is a duplicate and will not be changed.
> 
> *** This bug has been marked as a duplicate of 28222 ***
> 
> *** This bug has been marked as a duplicate of 28222 ***

Once this bug "is a duplicate and will not be changed", should I assume
getRequestURL() behaviour won't change, despite it's return value isn't
consistent with servlet specification? Or is it consistent? Should I look for
another solution, change my code?

I'm sorry for the inconvenient question, but I'm really looking for
clarification here.
Comment 6 Mark Thomas 2005-07-01 22:48:14 UTC
The return value is as required by SRV8.4

The javadocs are, in my view, misleading as none of them take any account of the
requirements of SRV8.4

If you want the original request, then obtain it as per SRV.8.4.2

There was some debate about this change on the tomcat-dev list but the
conclusion was that the current behaviour is the correct one.
Comment 7 Iran Marcius 2005-07-04 13:09:35 UTC
Thanks Mark. This really helped.

(In reply to comment #6)
> The return value is as required by SRV8.4
> 
> The javadocs are, in my view, misleading as none of them take any account of the
> requirements of SRV8.4
> 
> If you want the original request, then obtain it as per SRV.8.4.2
> 
> There was some debate about this change on the tomcat-dev list but the
> conclusion was that the current behaviour is the correct one.
Comment 8 Zhou Wu 2006-07-27 19:27:58 UTC
I don't know how to obtain origianl request url. I used the 
request.getAttribute("javax.servlet.forward.request_uri") and it returned the 
same thing as the request.getURI(). Can anyone give an example?


(In reply to comment #7)
> Thanks Mark. This really helped.
> (In reply to comment #6)
> > The return value is as required by SRV8.4
> > 
> > The javadocs are, in my view, misleading as none of them take any account 
of the
> > requirements of SRV8.4
> > 
> > If you want the original request, then obtain it as per SRV.8.4.2
> > 
> > There was some debate about this change on the tomcat-dev list but the
> > conclusion was that the current behaviour is the correct one.