This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Well, I think they simply have different purposes. Here's what the api's say HttpServletResponse.encodeURL( String url ) "Encodes the specified URL by including the session ID in it, 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. For example, if the browser supports cookies, or session tracking is turned off, URL encoding is unnecessary. For robust session tracking, all URLs emitted by a servlet should be run through this method. Otherwise, URL rewriting cannot be used with browsers which do not support cookies." And the very old java.net.URLEncoder() The class contains a utility method for converting a String into a MIME format called "x-www-form-urlencoded" format. To convert a String, each character is examined in turn: "The ASCII characters 'a' through 'z', 'A' through 'Z', '0' through '9', and ".", "-", "*", "_" remain the same. The space character ' ' is converted into a plus sign '+'. All other characters are converted into the 3-character string "%xy", where xy is the two-digit hexadecimal representation of the lower 8-bits of the character." So basically, the servlet version determines if the session object id needs to be stored in the query string (because the client doesn't accept cookies, for instance). The java.net version simply parse a query string into the various %20 and + signs etc. that we are used to seeing in the query string. Sean
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com