Hello Jan,
Thanks for the pointer, I will look into it. I actually cooked up
something that is working myself today. It is a plain HttpServlet that
implements the doGet/doPost methods and forwards to a set of applicable
backends based on Host names and URI patterns. It actually works quite
well as both a reverse proxy and a (roundrobin) loadbalancer that
implements sticky sessions (both cookie based and redirect/URL-rewriting
based).
However, my doPost/doGet methods implement the forwarding synchronously.
Your reference seems to suggest I should be doing something
asynchronously. That is why I will look into it and see how I can
improve (throughput, I guess).
Kind regards,
Jan Bartel wrote:
Hi Silvio,
You might want to take a look at the async client stuff in
$JETTY-HOME/extras/client. I think there's an example of how
to use the async client interface in
src/main/java/org/mortbay/servlet/AsyncProxyServlet.java
cheers
Jan
Silvio Bierman wrote:
Hello all,
I have looked at the ProxyServlet class to see if I can use it to create
reverse proxy functionality but I get stuck.
I would like to be able to receive HTTP GET/POST requests in a servlet,
forward that requests to some other IP address (preferably without
changing the Host header), receive the response of the forwarded
requests and then forward that as the response to the original request.
Off course I would like to be able to do some mapping logic in between.
My main purpose is to implement some load balancing logic at the
application level.
Can someone please give me some pointers on how to achieve this? I am
mainly an application level servlet programmer and far from an expert in
servlet or container internals.
Is the ProxyServlet a good place to start? Are there any other samples I
could look at? Any help would be very much appreciated.
Kind regards,