Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Send file using HTTP from thick application

 
tom tran
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am writing a Java app (thick app) and I'd like to send
files to a web server using HTTP protocol. If you know how
to do it, I would very much appreciate if you can tell me.
I already have an example of sending files using ftp but
what I want to use is HTTP since the requirement of communication
is HTTP.
Thanks in advance,
Tom Tran
trant@onr.navy.mil
 
ming fan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to use HTTP to send file, you have to send it as a multipart request, Jason Hunter gave out some sample code on how to write a multipart request in his book Java Servlet Programming. You can make changes to his MultipartRequest class sample, and that should work.

Originally posted by tom tran:
Hi,
I am writing a Java app (thick app) and I'd like to send
files to a web server using HTTP protocol. If you know how
to do it, I would very much appreciate if you can tell me.
I already have an example of sending files using ftp but
what I want to use is HTTP since the requirement of communication
is HTTP.
Thanks in advance,
Tom Tran
trant@onr.navy.mil

 
tom tran
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ming fan:
If you want to use HTTP to send file, you have to send it as a multipart request, Jason Hunter gave out some sample code on how to write a multipart request in his book Java Servlet Programming. You can make changes to his MultipartRequest class sample, and that should work.


Hi Ming:
Thanks for your response! I read the MultipartRequest class in Jason's Hunter book before. This class is used
for processing the HTTP request that you received in your servlet. So, although the class is useful, it is for server side
processing. What I am looking for is a way to construct an HTTP Request with file attachements that I can send to
the servlet (which in turn will use the MultipartRequest class above to unpackage it).
If you have information on what I need, please let me know right away. Sample code would be wonderful!!!
Many thanks,
Tom Tran
trant@onr.navy.mil
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic