hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mario Becker-Reinhold <mario.1...@gmx.de>
Subject HttpClient 3.1 PutMethod -> HttpClient 4 HttpPut
Date Fri, 18 Sep 2009 14:48:06 GMT

Hi Folks,

I'm trying to upgrade some code from HttpClient 3.1 to version 4.

The old code that does a simple PUT in 3.1 is:

HttpClient httpClient = new HttpClient();
PutMethod put = new PutMethod(this.getArchiveURL_Put()+ "/"
RequestEntity entity = new InputStreamRequestEntity(new
FileInputStream(fObject)); put.setRequestEntity(entity);	       				

Now, I don't know, how I can put the entity in version 4? There are no more
classes for RequestEntity and InputStreamRequestEntity. I didn't find any
code examples for Put, only for Get/Post, with this examples I tried to do
the following:

HttpClient httpClient = new DefaultHttpClient();
HttpPut put = new HttpPut(this.getArchiveURL_Put()+ "/" +fObject.getName());
FileBody filebody = new FileBody(fObject);
MultipartEntity entity = new MultipartEntity();
entity.addPart("file", filebody);

I have removed the jar files of version 3.1 and putted the 2 jar files of
version 4 (also to the build-path of eclipse), but now, with the code above,
I get the following error message in eclipse:
"The type org.apache.james.mime4j.message.SingleBody cannot be resolved. It
is indirectly referenced from required .class files"

Can anyone give me a hint or can tell me, if I am with the code above on the
right track?

Thanks in advance, 
best regards and have a nice weekend!

View this message in context: http://www.nabble.com/HttpClient-3.1-PutMethod--%3E-HttpClient-4-HttpPut-tp25510057p25510057.html
Sent from the HttpClient-User mailing list archive at Nabble.com.

To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org

View raw message