You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Foran, Christopher" <Ch...@fmr.com> on 2004/06/10 19:07:19 UTC
RE: PostMethod 's recycle method has problem
I think I know the answer to this one. You need to call .recycle()
after every .execute().
-----Original Message-----
From: Himanshu Thube [mailto:himanshut@kenati.com]
Sent: Thursday, June 10, 2004 10:18 PM
To: commons-httpclient-dev@jakarta.apache.org
Subject: PostMethod 's recycle method has problem
Hi all,
Thanks for all your answers for my questions till now. I have a problem
with PostMethod. When I reuse the same method it gives a exception that
PostMethod needs to be recycled. So I had put a check with help of
hasbeenUsed() method of PostMethod and trying to recycle the PostMethod.
Unfortunately my program hangs :( when it reaches recycle() call or even
if I try to print the ResponseBody of method.
Can someone let me know where could be the problem ??
Just to menthion, I am calling same post method with same request and
URL in a indefinite while loop until someone sets the while flag to
false.
- Himanshu
---------------------------------------------------------------------
To unsubscribe, e-mail:
commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail:
commons-httpclient-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org
Re: PostMethod 's recycle method has problem
Posted by Himanshu Thube <hi...@kenati.com>.
Hi Christopher
Well thats the main problem. When my code comes to asynchPost.recycle()
in code below the program hangs !!
I am giving some code below to give an idea. This is not the original
code though. Does anybody know whats wrong here ??
while(myflag) {
if(asyncState!=null) {
asynchPost.execute(asyncState,asyncConnection);
} else {
statusCode = asynchHttpsclient.executeMethod(asynchPost);
asyncState=asynchHttpsclient.getState();
}
if(asynchPost==null) {
if(usehttps) {
asynchPost = new PostMethod(httpsasynchUri.toString());
} else {
asynchPost = new PostMethod(httpasynchUri.toString());
}
} else if (asynchPost.hasBeenUsed()) {
asynchPost.recycle();
}
if(deviceProperty.getRequestObject()!=null) {
Document
request=(Document)deviceProperty.getRequestObject();
asynchPost.setRequestBody(new
String(MyUtils.getBytesOfDom(request)));
}
}
Foran, Christopher wrote:
>I think I know the answer to this one. You need to call .recycle()
>after every .execute().
>
>-----Original Message-----
>From: Himanshu Thube [mailto:himanshut@kenati.com]
>Sent: Thursday, June 10, 2004 10:18 PM
>To: commons-httpclient-dev@jakarta.apache.org
>Subject: PostMethod 's recycle method has problem
>
>
>Hi all,
>
>Thanks for all your answers for my questions till now. I have a problem
>with PostMethod. When I reuse the same method it gives a exception that
>PostMethod needs to be recycled. So I had put a check with help of
>hasbeenUsed() method of PostMethod and trying to recycle the PostMethod.
>
>Unfortunately my program hangs :( when it reaches recycle() call or even
>
>if I try to print the ResponseBody of method.
>
>Can someone let me know where could be the problem ??
>
>Just to menthion, I am calling same post method with same request and
>URL in a indefinite while loop until someone sets the while flag to
>false.
>
>- Himanshu
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail:
>commons-httpclient-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail:
>commons-httpclient-dev-help@jakarta.apache.org
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org