You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by z <zi...@gmail.com> on 2008/05/02 00:38:09 UTC

send requests in a same permanent connection

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