aspose file tools*
The moose likes Servlets and the fly likes Need help porting a CURL PUT uploader to java servlet (httpput possibly?) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Need help porting a CURL PUT uploader to java servlet (httpput possibly?)" Watch "Need help porting a CURL PUT uploader to java servlet (httpput possibly?)" New topic
Author

Need help porting a CURL PUT uploader to java servlet (httpput possibly?)

Tavis Hord
Greenhorn

Joined: Aug 29, 2013
Posts: 3
Hi all,

I have been googling for many hours trying to find some info on how to do this..

What I have is a php uploader example for posting videos to a (ooyala.com) server.
My app has a tomcat backend with various servlets for doing POSTS, PUTS, etc..

I need to port the php/curl sample code over to a servlet.

This is the working php code:



But I am confused hot to acomplish this with HttpPut in my servlet because I dont know how to attach the video data.
Heres my servlet code:




All I really need is help with how to port that php/curl code to a java servlet..
I'm pretty much a newb at this stuff so it is still a bit confusing..
I hope someone in here can help me, I will be truly grateful!!

Thanks in advance,

-Tavis

K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2628
    
    9

So is this the same as submitting the upload form and calling a servlet? Or have PHP do some stuff then call a servlet?

The first one can be done by using tomcat connector AJP (forwarding the request to servlet container from apache web server). Under this approach your entire upload processing logic is done in the servlet.

If the latter, PHP does have ability to call Java programs but this is still experimental. So I don't recommend it. Under this approach, the java does not need to be a servlet. http://www.php.net/manual/en/java.examples.php


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5 OCPBCD5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need help porting a CURL PUT uploader to java servlet (httpput possibly?)