hi there, i'm doing kind of the similar thing to a contractor, using embedded-jetty as servlet container, entry-point is jetty-handler,which parse the requests, afterwards the request will be either dispatched to webapp-handler/webapp deployer (which loads a fullblown war webapp), or will "reparsed" to apache-httpclient-reuquest & dispatched to ahc client which retrieves content from internet.
from jetty-handler i also have access to (jee-compliant) session-manager & the whole servlet stacks of the request/response lifecycle also wish i've known of your project before. cheers <[email protected]> wrote: > On Fri, 2012-05-25 at 17:44 +0200, Francois-Xavier Bonnet wrote: > > 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 > > > > Hi Francois-Xavier > > I think what you are describing is commonly referred to as a content > proxy. Curiously enough, I had to develop something very similar for one > of my commercial contracts. I wish I had known about the project at that > time. > > I understand you have good reasons for using the standard JEE API for > your platform. It does make good sense given the objectives of your > project. At the same time this might make it less likely to fit into the > existing project mix at HttpComponents. My main concern is that after > the initial contribution there will be no one to support and maintain > the module in the long run. > > Oleg > > > 2012/5/21 Oleg Kalnichevski <[email protected]> > > > > > 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: [email protected] > > > For additional commands, e-mail: [email protected] > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
