SV: [jdom-interest] One less TODO item

Elliotte Rusty Harold elharo at
Wed Oct 8 06:14:20 PDT 2003

At 10:34 PM +0200 10/7/03, Per Norrman wrote:

>Obviously, URLConnection records the redirects that are happening, but not
>that it determined to supply the trailing slash on its own. Is this a bug in

Perhaps, but I don't think so. The URL class (and presumably 
URLConnection though I'd have to check) will supply the / from 
getPath if there's no path component in the URL, at least for the 
http scheme.  What we see in your test case is that it will rewrite 
the URL if necessary when there's a redirect. However from the 
standpoint of the URL class scheme://authority does not require 
rewriting. The URL class understands that this path is / without 
stating it explicitly. However, other code like an XML parser that 
depends on the external form of the URL class should understand and 
account for this behavior, especially if its' going to do its own 
realtive URL resolution.


   Elliotte Rusty Harold
   elharo at
   Processing XML with Java (Addison-Wesley, 2002)

More information about the jdom-interest mailing list