Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2006

Tip: Looking for answers? Try searching our database.

Connecting to FTP from Java

Thread view: 
Nettar - 16 Mar 2006 15:02 GMT
Hi all,

I have a problem.

I want to connect to an ftp site from Java.
My problem is that my password has !, @ and # characters.

So, if I construct the url as ftp://user:pass@www.domain.com/file.txt
it doesn't work.

Can anyone help?

Thanks,
Jayarama Nettar.
tom fredriksen - 16 Mar 2006 15:37 GMT
> I want to connect to an ftp site from Java.
> My problem is that my password has !, @ and # characters.
>
> So, if I construct the url as ftp://user:pass@www.domain.com/file.txt
> it doesn't work.

Escape the character

/tom
Rhino - 16 Mar 2006 16:12 GMT
>> I want to connect to an ftp site from Java.
>> My problem is that my password has !, @ and # characters.
[quoted text clipped - 3 lines]
>
> Escape the character

For example: ftp://user\:pass\@www.domain.com/file.txt\#abc

(Untested!!)

--
Rhino
Timo Stamm - 16 Mar 2006 16:57 GMT
Rhino schrieb:
>>> I want to connect to an ftp site from Java.
>>> My problem is that my password has !, @ and # characters.
[quoted text clipped - 4 lines]
>>
> For example: ftp://user\:pass\@www.domain.com/file.txt\#abc

That's Java String escaping. What is required is probably URL escaping:

  p@ssword -> p%40ssword

Timo
Rhino - 16 Mar 2006 18:20 GMT
> Rhino schrieb:
>>>> I want to connect to an ftp site from Java.
[quoted text clipped - 9 lines]
>
>   p@ssword -> p%40ssword

You might be right; I've never tried to FTP to Java directly - I use Ant for
that purpose - and I was just trying to create an example of what Tom
Frederiksen suggested. I may have missed the boat though.

Sorry if I've given an inappropriate example!

--
Rhino
Nettar - 17 Mar 2006 06:11 GMT
Thanks Timo.

This URL escaping worked very well.

Thanks for all others who tried to help me.

Regards,
Jayarama Nettar.
Lord0 - 16 Mar 2006 17:15 GMT
You may want to look at Jakarta Commons Net
Jim McMaster - 17 Mar 2006 03:02 GMT
> You may want to look at Jakarta Commons Net

I second that.  I just had to add FTP functionality to an application.
Jakarta Commons Net made it very easy.

Signature

Jim McMaster
mailto:jim.mcmaster@gmail.com



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.