Return-Path: Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: (qmail 65341 invoked from network); 26 Nov 2008 15:58:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Nov 2008 15:58:24 -0000 Received: (qmail 10618 invoked by uid 500); 26 Nov 2008 15:58:34 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 10603 invoked by uid 500); 26 Nov 2008 15:58:34 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 10592 invoked by uid 99); 26 Nov 2008 15:58:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Nov 2008 07:58:33 -0800 X-ASF-Spam-Status: No, hits=1.4 required=10.0 tests=SPF_NEUTRAL,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [92.235.229.63] (HELO mail.triggersoft.com) (92.235.229.63) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 26 Nov 2008 15:57:05 +0000 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: Question about creating a simple HTTP proxy X-MimeOLE: Produced By Microsoft Exchange V6.5 Date: Wed, 26 Nov 2008 15:57:09 -0000 Message-ID: <419453E53580FC4594E09D41E0D3D5920189AB33@denzel.triggersoft.local> In-Reply-To: <20703487.post@talk.nabble.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Question about creating a simple HTTP proxy Thread-Index: AclP3iKr+PqvP21XQ66fJbRWKTcSlQAAFz5g References: <20703487.post@talk.nabble.com> From: "Chris Lowe" To: "HttpClient User Discussion" X-Virus-Checked: Checked by ClamAV on apache.org If it's just for debugging then I strongly recommend using the Charles Web Debugging Proxy: http://www.charlesproxy.com/ If your Java programs are using JDK APIs then you can specify the following VM argument "-Djava.net.useSystemProxies=3Dtrue" 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 Cheers, C. -----Original Message----- From: corpaul [mailto:koningcor@live.nl]=20 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