• Post Reply Bookmark Topic Watch Topic
  • New Topic

Transport files between servlets

 
Fernando Dominguez
Ranch Hand
Posts: 108
Debian Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I would like to get a file inside a machine to be transported to another machine using servlets.

I know how to get a file using a browser but I don't know how to get a file from a servlet.

This servlet code gets a file from a file system and send it to the browser.

I would like to catch that file with another servlet in another machine.


Thanks in advanced.
 
Richard Green
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to get a file inside a machine to be transported to another machine using servlets.

that sounds like an opening line for 'mission impossible - five' action movie

This servlet code gets a file from a file system and send it to the browser.

I would like to catch that file with another servlet in another machine.

why would you want to do that?
 
Fernando Dominguez
Ranch Hand
Posts: 108
Debian Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The reason to do that, is that I need two applications working together with the same file, the second one ask if the the file has been modified I that case, It gets the file, do the work, and send it back to the other machine.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Create a inputstream of that file (that is local to you now) using servletContext or any other convinient way.create a HTTPURLConnection to the consumer servlet and drive the content of the input stream to the output stream of the consumer servler.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!