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/11/18 17:43:19 UTC
DO NOT REPLY [Bug 13969] -
':' in parameter breaks encodeURL() and encodeRedirectURL()
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=13969>.
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=13969
':' in parameter breaks encodeURL() and encodeRedirectURL()
Brian.Ewins@btinternet.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
------- Additional Comments From Brian.Ewins@btinternet.com 2002-11-18 16:43 -------
':' and '%' are reserved characters in the URL spec
(http://www.w3.org/Addressing/rfc1738.txt, see section 5). You need to URL
encoded them, or you'll get either a MalformedURLException or undefined behaviour.
It seems probably you've misunderstood the meaning of encodeURL(). This doesn't
URL-encode a string (yes it does sound similar :) ) It adds the session id if
you're using URL rewriting to maintain sessions. See
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/servletapi/javax/servlet/http/HttpServletResponse.html#encodeURL(java.lang.String)
The correct way to write your code would be:
<%
response.sendRedirect(response.encodeRedirectURL("bug.jsp?ready="+java.net.URLEncoder.encode("Saturday
04:30"))); %>
this is JDK 1.3, in JDK 1.4, URLEncoder.encode(String) is deprecated and you
need to specify the charset for encoding:
<%
response.sendRedirect(response.encodeRedirectURL("bug.jsp?ready="+java.net.URLEncoder.encode("Saturday
04:30","UTF8"))); %>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>