tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 6659] - HttpUtils.getRequestURL gives incorrect URL with web.xml redirected error pages
Date Fri, 07 Jun 2002 14:55:06 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6659>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6659

HttpUtils.getRequestURL gives incorrect URL with web.xml redirected error pages





------- Additional Comments From bob@jadn.com  2002-06-07 14:55 -------

So... Does it make sence to just change the method 

	HttpUtils.getRequestURL( request )

so that it simply has 1 line,

	return request.getRequestURL() 

Since HttpServletRequest.getRequestURL() returns the correct answer?

I implemented this and tested it for me. and it seems to work just fine.

ie, this patch...
Index: jakarta-servletapi-4/src/share/javax/servlet/http/HttpUtils.java
===================================================================
RCS file:
/home/cvspublic/jakarta-servletapi-4/src/share/javax/servlet/http/HttpUtils.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 HttpUtils.java
--- jakarta-servletapi-4/src/share/javax/servlet/http/HttpUtils.java    9 Jan
2001 03:24:20 -0000       1.1.1.1
+++ jakarta-servletapi-4/src/share/javax/servlet/http/HttpUtils.java    7 Jun
2002 14:47:19 -0000
@@ -324,28 +324,7 @@
      */
 
     public static StringBuffer getRequestURL (HttpServletRequest req) {
-       StringBuffer url = new StringBuffer ();
-       String scheme = req.getScheme ();
-       int port = req.getServerPort ();
-       String urlPath = req.getRequestURI();
-
-       //String                servletPath = req.getServletPath ();
-       //String                pathInfo = req.getPathInfo ();
-
-       url.append (scheme);            // http, https
-       url.append ("://");
-       url.append (req.getServerName ());
-       if ((scheme.equals ("http") && port != 80)
-               || (scheme.equals ("https") && port != 443)) {
-           url.append (':');
-           url.append (req.getServerPort ());
-       }
-       //if (servletPath != null)
-       //    url.append (servletPath);
-       //if (pathInfo != null)
-       //    url.append (pathInfo);
-       url.append(urlPath);
-       return url;
+       return req.getRequestURL();
     }
 }

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message