hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: Question about creating a simple HTTP proxy
Date Wed, 26 Nov 2008 16:14:37 GMT
On 26/11/2008, Chris Lowe <chris.lowe@triggersoft.com> wrote:
> If it's just for debugging then I strongly recommend using the Charles
>  Web Debugging Proxy:
>
>  http://www.charlesproxy.com/

http://wiki.apache.org/jakarta-jmeter/NetworkSniffer

has some other suggestions.

>
>  If your Java programs are using JDK APIs then you can specify the
>  following VM argument "-Djava.net.useSystemProxies=true" and you should
>  see all traffic go through Charles.
>
>  http://java.sun.com/j2se/1.5.0/docs/guide/deployment/deployment-guide/pr
>  oxie_config.html

I doubt that will apply to HttpClient code as it uses sockets directly
rather than using UrlConnection.

>  Cheers,
>
>
>  C.
>
>
>
>
>  -----Original Message-----
>  From: corpaul [mailto:koningcor@live.nl]
>  Sent: 26 November 2008 15:45
>  To: httpclient-users@hc.apache.org
>  Subject: Question about creating a simple HTTP proxy
>
>
>  Hi,
>
>  I am trying to adjust the ReverseProxy example to build a (simple) HTTP
>  proxy. I need one to hook up to another Java application to see whether
>  a request was made and to which Host it was made, just for testing
>  purposes.
>  My desire is not to build a production quality proxy (although it would
>  be nice if it worked correctly ;) ).
>
>  I have a couple of questions about this:
>
>  1. Do such proxies exist for HttpClient / Java? I kinda have the feeling
>  I'm reinventing the wheel here.
>  2. Is adjusting the ReverseProxy example a good idea or is this way too
>  naive?
>  3. The code I have thus far gives me the following error for AJAX calls:
>  Exception in thread "Thread-6" java.lang.IllegalStateException: Content
>  has been consumed
>         at
>  org.apache.http.entity.BasicHttpEntity.getContent(BasicHttpEntity.java:8
>  4)
>         at
>  org.apache.http.entity.BasicHttpEntity.writeTo(BasicHttpEntity.java:126)
>         at
>  org.apache.http.impl.entity.EntitySerializer.serialize(EntitySerializer.
>  java:97)
>         at
>  org.apache.http.impl.AbstractHttpClientConnection.sendRequestEntity(Abst
>  ractHttpClientConnection.java:164)
>         at
>  org.apache.http.protocol.HttpRequestExecutor.doSendRequest(HttpRequestEx
>  ecutor.java:237)
>         at
>  org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor
>  .java:119)
>         at
>  usaproxytest.NHttpServer$HttpFileHandler.handle(NHttpServer.java:178)
>         at
>  org.apache.http.protocol.HttpService.doService(HttpService.java:243)
>         at
>  org.apache.http.protocol.HttpService.handleRequest(HttpService.java:187)
>         at
>  usaproxytest.NHttpServer$WorkerThread.run(NHttpServer.java:272)
>  What does this imply?
>
>  Thanks in advance for your time!
>
>  Cor-Paul
>  --
>  View this message in context:
>  http://www.nabble.com/Question-about-creating-a-simple-HTTP-proxy-tp2070
>  3487p20703487.html
>  Sent from the HttpClient-User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  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
>
>

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


Mime
View raw message