hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From z <zied.d...@gmail.com>
Subject send requests in a same permanent connection
Date Thu, 01 May 2008 22:38:09 GMT
Hi evry one

I want to connect to a servlet with a permanent connection, the servlet
handled that by receiving a "pong" message from a client's get request.
I didn't know how I send requests in the same connection , I tried to do one
request after an other like this :


private static String url = "http://localhost:8180/my_appli/my_servlet";

private static String  req1 = "?ActionType=login";
private static String  req2 = "?ActionType=pong";

                // Create an instance of HttpClient.
        HttpClient client = new HttpClient();

        // Create a method instance.
        GetMethod method = new GetMethod(url+req1);
        GetMethod method = new GetMethod(url+req2);

// Provide custom retry handler is necessary
           method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
                new DefaultHttpMethodRetryHandler(3, false));

           client.executeMethod(method);
           client.executeMethod(metho2);


but the 2nd is sent only if the servlet close connection after a certen time
out.

So  some one have an idea, how to do that ?

Thanks

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message