Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File transfer using Java Http

 
Dale Seng
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got a program that's using POJO's to do a little web server that takes commands. It works great, and it's tiny. But I'm not sure how to extend it to accept an inbound file transfer. Can anyone give me some coding advice for binary file transfer (sans the advice to install a web server...sorry, just not going to do that, this needs to REMAIN tiny). Below is the code I'm using. It's not going to compile out of the box for you...here to give you an idea about what I'm starting with.



 
Rob Spoor
Sheriff
Pie
Posts: 20529
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A binary file transfer is basically the same as text transfer but without using Writer and Reader, but sticking to InputStream and OutputStream (possibly wrapped in other streams).
 
Dale Seng
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:A binary file transfer is basically the same as text transfer but without using Writer and Reader, but sticking to InputStream and OutputStream (possibly wrapped in other streams).

Thanks Rob, for the ideas.

As you see in my code, I'm just expecting GET requests and looking at the plain text of the request. If set-up for handling a POST, you suggest I use an input stream and pull the form data, where the other party will have stuffed the binary? Sounds like there's enough here to embark on a trial, but I would expect to be reinventing the wheel (and finding the same bumps in the road others have found). Would you (or anyone) have any suggestions on where to find some sample code?

--Dale--
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic