aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Send file using HTTP from thick application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Send file using HTTP from thick application" Watch "Send file using HTTP from thick application" New topic
Author

Send file using HTTP from thick application

tom tran
Greenhorn

Joined: Apr 30, 2001
Posts: 2
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

Joined: Nov 15, 2000
Posts: 21
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

Joined: Apr 30, 2001
Posts: 2
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Send file using HTTP from thick application