hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Ball <joshbb...@gmail.com>
Subject Re: Capturing request outputstream from HttpClient.
Date Sat, 14 Aug 2010 20:29:45 GMT
Here is what I have tried so far, but it just returns an empty string:

    private String serializeRequest(HttpRequest httpRequest) throws
IOException, HttpException {
        final ByteArrayOutputStream os = new ByteArrayOutputStream();
        VirtualOutputBuffer vob = new VirtualOutputBuffer(os, 1024,
httpRequest.getParams());
        LineFormatter lf = new BasicLineFormatter();
        HttpRequestWriter hrw = new HttpRequestWriter(vob, lf,
httpRequest.getParams());
        hrw.write(httpRequest);
        os.flush();
        return new String(os.toByteArray(), "UTF-8");
    }

    private static class VirtualOutputBuffer extends
AbstractSessionOutputBuffer {
        private VirtualOutputBuffer(OutputStream outputStream, int
buffersize, HttpParams params) {
            init(outputStream, buffersize, params);
        }
    }


On Sat, Aug 14, 2010 at 1:27 PM, Joshua Ball <joshbball@gmail.com> wrote:

> Hi,
>
> How can I capture the output generated for a http get/post? (for debugging
> purposes)
>
> Normally I would just use wireshark, but the remote server only accepts
> SSL.
>
> Josh "Ua" Ball
>

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