Return-Path: X-Original-To: apmail-hc-dev-archive@www.apache.org Delivered-To: apmail-hc-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BF09CC99C for ; Fri, 25 May 2012 15:44:35 +0000 (UTC) Received: (qmail 9096 invoked by uid 500); 25 May 2012 15:44:35 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 9070 invoked by uid 500); 25 May 2012 15:44:35 -0000 Mailing-List: contact dev-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list dev@hc.apache.org Received: (qmail 9061 invoked by uid 99); 25 May 2012 15:44:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 May 2012 15:44:35 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [209.85.212.51] (HELO mail-vb0-f51.google.com) (209.85.212.51) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 May 2012 15:44:27 +0000 Received: by vbip1 with SMTP id p1so761499vbi.10 for ; Fri, 25 May 2012 08:44:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:content-type:x-gm-message-state; bh=Hsv5nccp5aY2XTUTm0pHvIxf9qtSPInZvpc5sjVKWu8=; b=V6L/8H0BQQMPdZqxJkWmARIcNSz3N3mP0B0VTijqF9JBmOk+JjTqo9x7IESAw5btjJ BAqP5xFuBERC97X8ouUBPN9bvuo+ATXtt7l0hOdLlBcyvIl5j29FPlDIFbg/8gDbSmmV 5QwzcyTI1oav8oGRpo94qEbxFmFvRtnbyj9K7A6rXuB0FjrFsgLhKhZtxv8odgzxwkEc u7SmztkVwslzo53xJYbHRs7Z3qMGNQALZoa6JmZymV4kM0WERFACp98sBXgSABFmYN4Y PmmGpf66c3iW8RMkymGULWuhR4MeA77DnWl109HFedkzaiLTkORi6tNaJt3pICD0lrWM sDXA== MIME-Version: 1.0 Received: by 10.52.20.35 with SMTP id k3mr3615463vde.44.1337960646122; Fri, 25 May 2012 08:44:06 -0700 (PDT) Received: by 10.220.155.139 with HTTP; Fri, 25 May 2012 08:44:05 -0700 (PDT) X-Originating-IP: [91.216.209.254] In-Reply-To: <1337614494.2732.18.camel@ubuntu> References: <1337614494.2732.18.camel@ubuntu> Date: Fri, 25 May 2012 17:44:05 +0200 Message-ID: Subject: Re: Reverse-proxy From: Francois-Xavier Bonnet To: HttpComponents Project Content-Type: multipart/alternative; boundary=20cf307ca02c091b3c04c0de3d8a X-Gm-Message-State: ALoCoQl6cyHoo8hiCgXvyNvJS+LEJXI6a7OSuqx2ntO9lt76aYDkJpM+Blf5aIP20u1pKizTEAv2 --20cf307ca02c091b3c04c0de3d8a Content-Type: text/plain; charset=ISO-8859-1 Hi Oleg, In fact the reverse proxy is only one part of our project. It is called EsiGate http://www.esigate.org The goal of the project is to have a tool that can be used to retrieve some contents from different servers and aggregate them as a single web application. The library is often used embeded inside a webapp and it includes a reverse proxy servlet as well as taglibs and an implementation of ESI specification in order to be able to extract and transform the contents. So we definitely need to run inside a servlet container. The project is open source so if you see some things that could be interesting to other people we could think about integrating to HttpClient project. Francois-Xavier 2012/5/21 Oleg Kalnichevski > On Mon, 2012-05-21 at 15:19 +0200, Francois-Xavier Bonnet wrote: > > Hi all, > > > > I am using HttpClient to do some reverse-proxy inside java web > > applications. Maybe it could be useful to other people. What about > adding a > > reverse-proxy as a subproject to HttpClient project ? > > > > I was thinking of 2 classes : > > - ProxyHttpRequest > > - ProxyHttpResponse > > > > A basic use inside an HttpServlet would look like this : > > > > protected void doPost(HttpServletRequest httpServletRequest, > > HttpServletResponse httpResponse) > > throws ServletException, IOException { > > HttpRequest httpRequest = new ProxyRequest(httpServletRequest); > > HttpResponse httpResponse = httpClient.execute(target, httpRequest); > > ProxyHttpResponse proxyHttpResponse = new > > ProxyHttpResponse(httpResponse);I > > proxyHttpResponse.forward(httpServletResponse); > > } > > > > So these classes would take care of all the problems of copying the right > > Http headers and entity of the request or response. They will make the > > translation between Servlet API and HttpClient API. > > In addition it would be possible to modify the request or the response > > before forwarding them depending on your needs. > > > > Hi Francois-Xavier > > A reverse proxy module would be nice, but ideally it should be using > HttpCore instead of Servlet API for management of incoming connections. > At the same time your code would make a perfect sample application for > HttpClient [1]. So, please feel free to contribute your code to the > project as long as you are fine with it being distributed as reference > material only. > > Cheers > > Oleg > > [1] http://hc.apache.org/httpcomponents-client-ga/examples.html > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org > For additional commands, e-mail: dev-help@hc.apache.org > > --20cf307ca02c091b3c04c0de3d8a--