You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by sean machin <sm...@yahoo.com> on 2005/04/22 21:00:44 UTC
how to handle spaces in filenames?
Hi All,
I'm using the HTTP client lib., what is the best way to download a file
containing spaces in the name (e.g. "one two.xml") using this library.
If I don't do any special filename encoding at all, I get :
java.lang.IllegalArgumentException: Invalid uri '/admin/diff_access/one
two.xml': escaped absolute path not valid
Thanks,
Sean
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
Re: how to handle spaces in filenames?
Posted by Michael Becke <mb...@gmail.com>.
Hi Sean,
Please have a look at the URI class included with HttpClient. It has
methods for building a properly escaped URL which get be passed to the
constructor of GetMethod(), PostMethod(), etc.
Mike
On 4/22/05, sean machin <sm...@yahoo.com> wrote:
> Hi All,
>
> I'm using the HTTP client lib., what is the best way to download a file
> containing spaces in the name (e.g. "one two.xml") using this library.
> If I don't do any special filename encoding at all, I get :
>
> java.lang.IllegalArgumentException: Invalid uri '/admin/diff_access/one
> two.xml': escaped absolute path not valid
>
> Thanks,
> Sean
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
Re: how to handle spaces in filenames?
Posted by Sean Timm <Ti...@aol.com>.
Use %20 to encode spaces in a filename. '+' if it is in form data.
-Sean
smachin1000@yahoo.com wrote:
> Hi All,
>
> I'm using the HTTP client lib., what is the best way to download a file
> containing spaces in the name (e.g. "one two.xml") using this library.
> If I don't do any special filename encoding at all, I get :
>
> java.lang.IllegalArgumentException: Invalid uri
> '/admin/diff_access/one two.xml': escaped absolute path not valid
>
> Thanks,
> Sean
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org