commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tracy Boehrer" <tboeh...@calltower.com>
Subject RE: [httpclient] URL encoding
Date Tue, 27 May 2003 13:53:36 GMT
Given:

	import java.net.*;
	import java.util.*;

	import org.apache.commons.httpclient.*;
	import org.apache.commons.httpclient.methods.*;

	public class MyGetContents
	{
		public static void main(String args[]) throws MalformedURLException
		{
			try
			{		
				HttpClient client = new HttpClient();
				GetMethod gm = new GetMethod( "http://mail2:80/exchange/tboehrer/Inbox/RE: Test Message.EML"
);
				client.executeMethod( gm );
			}
			catch( Exception e )
			{
				System.out.println( e );
			}
		}
	}

Since I don't have the URL esaped, I get the following exception:

java.lang.IllegalArgumentException: Invalid uri 'http://mail2:80/exchange/tboehrer/Inbox/RE:
Test Message.EML': escaped absolute path not valid

If I escape the URL to be: http://mail2:80/exchange/tboehrer/Inbox/RE:%20Test%20Message.EML,
then after "parsedURI.getEscapedPath()" (below), the resultant URL is http://mail2:80/exchange/tboehrer/Inbox/RE:%2520Test%2520Message.EML.

Just so that I could move on, I changed "parsedURI.getEscapedPath()" to "parsedURI.getPath()"
and it seems to work fine.

-----Original Message-----
From: Adrian Sutton [mailto:Adrian.Sutton@Ephox.com]
Sent: Sunday, May 25, 2003 5:55 PM
To: 'Jakarta Commons Users List'
Subject: RE: [httpclient] URL encoding


Hi Tracy,
HttpClient should take only fully encoded URIs so the behaviour you describe
would be a bug, however I can't reproduce the problem.  Could you please
send through a simple test case showing the problem or at least the source
code you're using that experiences the problem?

Thanks in advance,

Adrian Sutton, Software Engineer
Ephox Corporation
www.ephox.com 

-----Original Message-----
From: Tracy Boehrer [mailto:tboehrer@calltower.com]
Sent: Saturday, 24 May 2003 12:04 AM
To: commons-user@jakarta.apache.org
Subject: [httpclient] URL encoding


Using the nightly source drop for 5/22, I am a bit confused as to what is
required of a URL when constructing a HttpMethodBase.  If I supply an
unescaped URL (that requires it), an exception is thrown.  If I escape the
URL, then this class will escape it again at around line 277:

            // set the path, defaulting to root
            setPath(
                parsedURI.getPath() == null
                ? "/"
                : parsedURI.getEscapedPath()
            );





Mime
View raw message