commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Allistair Crossley" <>
Subject HttpClient Hanging on executeMethod(HttpMethod)
Date Thu, 02 May 2002 14:30:05 GMT
Hi All,

I am going to paste a block of code below. I am trying to post to a URL and
what happens is it hangs on httpClient.executeMethod(PostMethod).

I am not sure why this could be and so am hoping you may be able to help.
What is even more weird is that I expected after an interval the try..catch
block to catch something like a NoRouteToHost or UnknownHost exception but
nothing is definately hanging at the executeMethod statment as
I never get to the System.print after it.

Your help appreciated, Ali

			// create http client post

			PostMethod postMethod = new PostMethod();

			// process out and add params to post

   			StringTokenizer t = new StringTokenizer(postString, "&");
   				String pair = removePercent20(t.nextToken()); //abc=123
   				System.out.println("IntegrationQueueClient: name/val pair; " + pair);

   				int equals = pair.indexOf("=");
   				//postMethod.addParameter(pair.substring(0, equals),
pair.substring(equals + 1));

			// establish connection to server and post
			HttpClient httpClient = new HttpClient();
			httpClient.startSession("123.456.78.9", 80);

			System.out.println("IntegrationQueueClient: session started");


			System.out.println("IntegrationQueueClient: ending session");


        	System.out.println("IntegrationQueueClient: session ended");

        	//System.out.println("IntegrationQueueClient: " +
		catch(Exception e)
   			System.out.println("IntegrationQueueClient: " + e);

Allistair Crossley
Lead Technical Developer
Obvious Solutions (Global) Ltd.
“Delivering the vision for a mobile lifestyle”

(m) +44 (0) 7884 056 274
(w) +44 (0) 20 8451 9352
(f) +44 (0) 20 8537 5236


This is an email from Obvious Solutions (Global) Ltd.
The contents of this email are confidential to the ordinary
user of the email address to which it was addressed. No-one
else may copy or forward all or any of it in any form.
If you receive this email in error, we should be obliged if
you would telephone our postmaster on +44 (0)208 357 8352
or  email Thank you.

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message