This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Hey? Which bit's deprecated? Also, if you are using cookies, the session id won't get appended to the URL anyway. Adam
I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
Hi.. Instead of using encodeURL use encodeRedirectURL of the httpservletresponse object. That will even support the encoding of url with or without the browser's cookies support. Just read this.... public java.lang.String encodeRedirectURL(java.lang.String url) Encodes the specified URL for use in the sendRedirect method or, if encoding is not needed, returns the URL unchanged. The implementation of this method includes the logic to determine whether the session ID needs to be encoded in the URL. Because the rules for making this determination can differ from those used to decide whether to encode a normal link, this method is seperate from the encodeURL method. All URLs sent to the HttpServletResponse.sendRedirect method should be run through this method. Otherwise, URL rewriting cannot be used with browsers which do not support cookies.
------------------ Narasimha Reddy --------------- Sun certified Enterprise architect(Part-I) Sun Certified Web Component Developer IBM Certified in OOAD with UML IBM Certified in enterprise connectivity test Oracle Certified in SQL and PL/SQL. Sun Certified Java2 Programmer
Narasimha Reddy<BR>---------------<BR>Sun certified Enterprise architect(Part-I)<BR>Sun Certified Web Component Developer<BR>IBM Certified in OOAD with UML<BR>IBM Certified in enterprise connectivity test<BR>Oracle Certified in SQL and PL/SQL.<BR>Sun Certified Java2 Programmer
Adam: check the API carefully. There are two methods, encodeURL and encodeUrl, the former being the one to use, and the later being deprecated.
narasimha: the original poster is not using the URL to redirect a response, only to output the link to the output stream.
Both methods (encodeRedirectURL and encodeURL) will support the encoding urls when the browser doesn't offer cookie support.
Adam's idea is probably accurate, that the browser probably has cookies enabled, so encodeURL doesn't appear to do anything.
malhar, if you use Tomcat, there is a post already here at javaranch that talks about how to force Tomcat to use URL re-writing, no matter what the browser uses (cookies or no). That way, you could test the encodeURL without having to affect your browser settings. Other servlet containers might have similar functionality. http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/context.html (search this page for 'cookies')
Joined: Aug 17, 2001
Originally posted by Mike Curwen: malhar, if you use Tomcat, there is a post already here at javaranch that talks about how to force Tomcat to use URL re-writing, no matter what the browser uses (cookies or no). That way, you could test the encodeURL without having to affect your browser settings. Other servlet containers might have similar functionality. http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/context.html (search this page for 'cookies')
sorry dear i m not using TOMCAT, but then how wud i resolve the prob, i.e to encode the URL with the session id..?? tia malhar