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:[EMAIL PROTECTED] Sent: Thursday, June 10, 2004 10:18 PM
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]