Yes, it is quite straight forward as you just basicall construct the regexp
patterns in the init method and then it just modifies the forwarded path if
it matches one of the patterns, the rest is basically the same as Caucho's
HttpProxyServlet so it shouldn't be too difficult to add.

And some extra pointers, I did not think you would be so efficient as to
create a bug report from my previous message ;), one thing that we also
added, and found useful, is another init parameter: TIMEOUT_X that allows
you to specify a timeout for the requests that are forwarded for a specific
pattern, just to prevent HttpURLConnections from hanging forever. That
introduced a library dependency, as we need to be able to run with JDK1.4
and HttpURLConnection.setConnectTimeout is not available until JDK1.5, but...

And lastly, another thing that we did in order to be able to use the proxy
with requests that have been "included" through the request dispatcher, is
to check if the attribute "javax.servlet.include.request_uri" is present in
the request and if it is, use that as the URI to be matched/forwarded.
Otherwise, requests "included" in non-proxied pages are never proxied, as
request.getRequestURI() returns the same value as the parent page. If I'm
not mistaken, looking at the source, HttpProxyServlet does not handle that
case right now.

And regarding the load-balancing capabilities, I understand that having an
all-in-one servlet that proxies and adds load balancing would be nice, but
wouldn't it be simpler to leave HttpProxyServlet as a dispatcher and
leaving it up to the back-end server to take care of that issue? Using the
load-balancer or any other kind of mechanism. Well, I guess the recommended
approach now :).

I'm just wondering whether it would not mean complicating too much a
servlet that in my mind sounds as needing to be quite straight-forward. But
of course, you could make it that if load-balancing is not selected then it
follows a more simplistic logic path with no extra overhead... never mind,
just rambling :).


> On Nov 7, 2006, at 4:39 AM, Daniel López wrote:
> Excellent.  I've added it as a bug report.
> Another enhancement we're looking at for the proxy is to give it the  
> same load-balancing capabilities that the resin load-balancer already  
> uses.  Your enhancement looks fairly straightforward.
> -- Scott
> > ----
> >    <filter>
> >      <filter-name>ProxyFilter</filter-name>
> >      <filter-class>org.leaf.filters.ProxyFilter</filter-class>
> >      <init-param>
> >        <param-name>MATCHING_URL_APP_1</param-name>
> >        <param-value>/ca/app/(.*).html</param-value>
> >      </init-param>
> >      <init-param>
> >        <param-name>REPLACEMENT_URL_APP_1</param-name>
> > <param-value>$1.html</param-value>
> >      </init-param>
> >      <init-param>

resin-interest mailing list

Reply via email to