commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thilo Roessler <>
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, 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: 
        at Post141.main(

Here is a piece of my code:
HttpConnection CPGCon;

CPGCon = new HttpConnection("",
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){
		i = i + 1;
	}; // while (postHeaders[i].toString() <> "")
}; // if i > 0 then

System.out.println("Connection closed");

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


View raw message