hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tim.aus...@abs.gov.au
Subject getResponseAsStream() slow to close
Date Tue, 02 Aug 2005 00:56:17 GMT
Hi All,

I am using HttpClient 3 to send serialised objects to a servlet and back
again. I use the getResponseAsStream() on the post method to deserialise
responses. All works fine, until I sent back larger objects. Then the
close() on the inputStream or the releaseConnection() blocks for several
seconds, even thought I have already read the Object in. HEre is my code

// Send the message using Http Client
// and the MultiThreaded Connection Manager

            client = new HttpClient(HttpMessagingProvider

            method = new PostMethod(host);

            InputStreamRequestEntity entity = new InputStreamRequestEntity(




    long freddy = inMethod.getResponseContentLength();

        if (freddy <= 0)
            throw new IOException("only " + freddy
                    + " bytes sent from server services");

        BufferedInputStream bis =
            new BufferedInputStream( inMethod.getResponseBodyAsStream() );

        int num = bis.available();

        ObjectInputStream ois = new ObjectInputStream( bis );
        IAsynchMessage message = (IAsynchMessage) ois.readObject();
        bis.close(); // blocks here when freddy is over 8000 bytes (


ABS Web Site:  www.abs.gov.au

To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org

View raw message