You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2002/06/07 16:55:06 UTC

DO NOT REPLY [Bug 6659] - HttpUtils.getRequestURL gives incorrect URL with web.xml redirected error pages

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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>