hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Reverse-proxy
Date Mon, 21 May 2012 15:34:54 GMT
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.



[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

View raw message