commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thilo Roessler <el-n...@gmx.li>
Subject HTTPClient, PostMethod and setRequestBody
Date Mon, 02 Dec 2002 10:28:19 GMT
Hello to all of you!

As I mentioned in an earlier mail, I try uploding a File to a HTTP-URL using 
the PostMethod of HTTPClient. Looking through the API-Documentation on the 
jakarta-homepage, I found a method called "setRequestody".
When trying to use it, i recognized that in my version of HTTP-Client (Alpha1 
which I downloaded from jakarta.apache.org), this method does not exist. So I 
got th latest GUMP-generated binary. There, the desired method existed ... 
unfortunately, other parts of my programm did not work anymore when using 
this Version of HTTPClient.

When running my program, I received the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: 
org/apache/commons/logging/LogFactory
        at 
org.apache.commons.httpclient.HttpConnection.<clinit>(HttpConnection.java:853)
        at Post141.main(Post141V2.java:42)


Here is a piece of my code:
=============================================================
HttpConnection CPGCon;

CPGCon = new HttpConnection("tn.integration.cpgmarket.com",
						443,
						true);

CPGCon.open();
System.out.println("Connection open");

PostMethod post2CPG;
post2CPG = new PostMethod("/invoke/CPGmarketTN.partner.push/receiveDocument");
System.out.println("Post Method created");

post2CPG.setRequestHeader("Content-type", "multipart/form-data");

Header[] postHeaders = post2CPG.getRequestHeaders();

int i;
i = postHeaders.length;
System.out.println("Header-Fields: " + i);
if (i > 0) {
	i = 0;
	while (i < postHeaders.length){
		System.out.println(postHeaders[i].toString());
		i = i + 1;
	}; // while (postHeaders[i].toString() <> "")
}; // if i > 0 then
			
post2CPG.setRequestBody("bla");

CPGCon.close();
System.out.println("Connection closed");
=============================================================

Is there anybody who has an idea what I am doing wrong?

Thilo

Mime
View raw message