aspose file tools*
The moose likes Java in General and the fly likes Java code to Download a file from Server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java code to Download a file from Server" Watch "Java code to Download a file from Server" New topic
Author

Java code to Download a file from Server

Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Hi
Could someone please assist me with a java code not servlet or jsp. To download a file (any type) from client to server
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42926
    
  68
What kind of server - FTP, HTTP, something else?
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
when I say Server that is a UNIX BOX in that my application is running on OC4J.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42926
    
  68
The server needs to be set up to serve files somehow. The approach you'd take to download files depends on the ways in which the server is prepared to serve them. Or are you saying that you can configure and/or code the server in whichever way is most convenient for the client?
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Yes exactly !!!

Need code for most convenient to the client..
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42926
    
  68
Then I'd go with FTP (assuming that a shared directory is not an option). The Apache Commons Net library contains everything you need to write an FTP client.
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Actually I need to print some datas from server in client printer. Can I print it directly from the server or download it to client machine then send it to printer. which is a better option
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42926
    
  68
If the client printer is a network printer, then the server should be able to access it. if the printer is connected directly to the client computer, then it won't work.
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Thanks Ulf. But my question is regarding performance, Printer from the server is better or downloading the content to client and sending it to printer is good
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Any suggestions are welcome
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42926
    
  68
Performance as defined how - the time it takes to print something? I hope you're not basing any architectural decisions on something like that. Furthermore, the performance is irrelevant if it isn't possible at all (like if a desktop printer isn't reachable by the server).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java code to Download a file from Server