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 Joshua Ball <jo...@gmail.com> on 2010/08/14 22:27:26 UTC
Capturing request outputstream from HttpClient.
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
Re: Capturing request outputstream from HttpClient.
Posted by Joshua Ball <jo...@gmail.com>.
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 <jo...@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
>
Re: Capturing request outputstream from HttpClient.
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sun, 2010-08-15 at 16:03 -0400, Ryan Smith wrote:
> WRT logging, in 4.x how do you only log the wire headers and not the wire
> content? In 3.x they were in different packages so I could configure a
> different log level in log4j.xml.
> Now they are in the same package.
>
---
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%c] %m%n
log4j.logger.org.apache.http=DEBUG
log4j.logger.org.apache.http.wire=ERROR
---
Oleg
> On Sun, Aug 15, 2010 at 3:13 PM, Oleg Kalnichevski <ol...@apache.org> wrote:
>
> > On Sat, 2010-08-14 at 13:27 -0700, Joshua Ball wrote:
> > > Hi,
> > >
> > > How can I capture the output generated for a http get/post? (for
> > debugging
> > > purposes)
> > >
> >
> > What's wrong with wire logging?
> >
> > Oleg
> >
> > > Normally I would just use wireshark, but the remote server only accepts
> > SSL.
> > >
> > > Josh "Ua" Ball
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> >
> >
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
Re: Capturing request outputstream from HttpClient.
Posted by Ryan Smith <ry...@gmail.com>.
WRT logging, in 4.x how do you only log the wire headers and not the wire
content? In 3.x they were in different packages so I could configure a
different log level in log4j.xml.
Now they are in the same package.
On Sun, Aug 15, 2010 at 3:13 PM, Oleg Kalnichevski <ol...@apache.org> wrote:
> On Sat, 2010-08-14 at 13:27 -0700, Joshua Ball wrote:
> > Hi,
> >
> > How can I capture the output generated for a http get/post? (for
> debugging
> > purposes)
> >
>
> What's wrong with wire logging?
>
> Oleg
>
> > Normally I would just use wireshark, but the remote server only accepts
> SSL.
> >
> > Josh "Ua" Ball
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>
Re: Capturing request outputstream from HttpClient.
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sat, 2010-08-14 at 13:27 -0700, Joshua Ball wrote:
> Hi,
>
> How can I capture the output generated for a http get/post? (for debugging
> purposes)
>
What's wrong with wire logging?
Oleg
> Normally I would just use wireshark, but the remote server only accepts SSL.
>
> Josh "Ua" Ball
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org