SV: [jdom-interest] One less TODO item

Per Norrman pernorrman at telia.com
Tue Oct 7 13:34:19 PDT 2003


I can understand the redirect issue. I didn't realize the
HTTP GET problem, and you're obvioulsy correct. Then, shouldn't
URLConnection#getUrl reflect this fact, even in the absent path
case?

A quick test:
	
      public static void main(String[] args) throws Exception {
        
        
        testURLConnection("http://www.ibm.com");
        testURLConnection("http://www.ibiblio.org/xml");
        testURLConnection("http://www.cafeconleche.org");
	}

	private static void testURLConnection(String uri)
		throws MalformedURLException, IOException {
		URL url = new URL(uri);
		URLConnection conn = url.openConnection();
            conn.getContent();
		System.out.println(conn.getURL().toExternalForm());
	}

produces

	http://www.ibm.com/us/
	http://www.ibiblio.org/xml/
	http://www.cafeconleche.org

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
URLConnection?

/pmn

> -----Ursprungligt meddelande-----
> Från: jdom-interest-admin at jdom.org 
> [mailto:jdom-interest-admin at jdom.org] För Elliotte Rusty Harold
> Skickat: den 7 oktober 2003 20:53
> Till: Per Norrman
> Kopia: jdom-interest at jdom.org
> Ämne: Re: SV: SV: [jdom-interest] One less TODO item
> 
> 
> At 2:07 PM -0400 10/7/03, Elliotte Rusty Harold wrote:
> 
> >I'm not sure if Xerces is correctly updating the XML parser with the
> >actual redirected base URI or not. I should write a test case for 
> >that and find out.
> >
> 
> I've now written the test case. See 
> http://www.cafeconleche.org/redirecttest.xml
> (with validation turned on to make sure the DTD loads). Xerces is 
> *not* using the right base URI. libxml gets this wrong too. I'll file 
> the bug with Apache.
> 
> Hmm, looks like I already did. See 
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20383
> Bugzilla says it was fixed in CVS a couple of weeks after the release 
> of Xerces-J 2.5, so presumably the fix will show up in 2.6 which last 
> I heard was due in November.
> 
> Once that's done, all JDOM should need to do is bundle Xerces 2.6 or 
> later and make sure it's used instead of the JDK default parser and 
> this should all take care of itself.
> 
> -- 
> 
>    Elliotte Rusty Harold
>    elharo at metalab.unc.edu
>    Processing XML with Java (Addison-Wesley, 2002)
>    http://www.cafeconleche.org/books/xmljava
>    http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/yo
uraddr at yourhost.com




More information about the jdom-interest mailing list