Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Using a URL to Create a File in a Specific Folder

 
Ranch Hand
Posts: 1985
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a data file that contains file paths.

like:
http://sgai-fs02.corp.zodiac.lan/drawings/810000/817739P1.pdf

In java I would like to loop through this data and create this path result(pdf file) in a particular shared folder.

I will make the directory dynamically:

 
Ranch Foreman
Posts: 95
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, what's the issue/question then?
 
Saloon Keeper
Posts: 21967
149
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Definitely, please explain more clearly what you are actually hoping to do.

But I can offer some cautions. A web server is not a file server. When you use an http: URL to access a "file", what you are actually doing is requesting that the web server should locate or construct the resource (the "R" in URL) and send  a copy of the resource data to your client program. If you want to save that resource as a local file, that's fine, but the resource data itself is not a file.

If you set the right headers in the URL response stream, and your client is configured to be agreeable, you will be prompted to save the resource data in a file at a location that you specify in the pop-up "File Save As..." dialog (assuming a GUI client like a web browser). Depending on the OS and client app (and its settings), you may see a default save file name/path pre-loaded into that dialog.

You cannot have the server force a file to save to a specific location. In fact, you cannot have the server force a file to be saved at all. That would not only be rude, and non-portable ("C:\some directory\file.txt" doesn't work too well on my Linux machine), it would also be how a server could be used to inject malware onto a client. So instead the client has to actively participate in the process. Sadly, all too many clients have users who will happily download malware on their own, but that's a different story.
 
Steve Dyke
Ranch Hand
Posts: 1985
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Holloway wrote:Definitely, please explain more clearly what you are actually hoping to do.



I got it figured out. Thanks for steering me in the right direction. Here is the code I used.

 
I have always wanted to have a neighbor just like you - Fred Rogers. Tiny ad:
Try Free Java/.NET Libraries for Word Excel PowerPoint and PDF
htttp://www.e-iceblue.com/free-apis.html
    Bookmark Topic Watch Topic
  • New Topic