I have been trying to download a file from the ftp server, barring it none of the other files or the directories have been assigned any access rights. Now when I try and download this file from the browser with the filepath appended to the url I face no problem. Whereas when I try to download it via the Java code I face access related exception. The reason I understand is that since the code makes connection with the server first and then checks for directory rights(which are false in this case) I'm unable to download the file.
Could anyone help me understand what procedure the browser might be making use that it is allowed to download the file even though the parent directories of this file have no rights? Or if anybody can suggest an alternative approach then nothing like it.
I have attempted to download th file by making use of the following approach:
The slash i missed out was a typo and I have tried the url with the type specification i.e type=d and without it (i.e the actual password embedded url) and none work with both approach. Surprisingly when I try and download the file by making use of the same url I face no hassles i face in downloading the file.
URL : URL redacted, though it looks correct JCE
The exception I encounter is:
Joined: Feb 11, 2010
With approach two I face the following exception:
java.net.UnknownHostException: ftp:/URL REDACTED/
Exception in thread "main" java.lang.NullPointerException at org.apache.commons.net.telnet.TelnetClient.disconnect(TelnetClient.java:124)
Java Result: 1
There's something weird about that FTP server. If I log in using your credentials, I can't CD to the download directory:
I don't know why it works with a browser.
By the way, it looks like your URL above goes to live data. I am going to remove it so you aren't exposing your data.
As for why you are getting a UnknownHostException: with approach #2, I can't tell you since you aren't showing us the URL you are using.
You should probably set up a test environment with bogus data so you can do realistic testing without exposing real data.
Joined: Feb 11, 2010
Thats because, barring the file ftmyersbeach_data.zip no access rights have been provided be it directories or files. Its just this sole file.
Yes thats why I was avoiding sharing it in the first place..
Following is the second approach with the URL specified again (you can remove it, just wanted to provide clarity if that could help):
Could anybody help me... I really don't get what is the browser's approach and how is it any different from mine..
Or any other workaround - something similar to calling this url via a browser maybe?