2015-01-14 12:46 GMT+01:00 André Warnier <a...@ice-sa.com>: > Jose María Zaragoza wrote: >> >> Hello: >> >> I would like to create a web filter to forward some requests to >> another webserver, >> >> The filter receives an "application/x-www-form-urlencoded" request , >> inspects the value of a parameter and chooses to forward to another >> remote webserver ( as a proxy )
Thanks I agree with you . I'll try to use an Apache httpd front-end Anyway, I've seen that if I execute Map<String, String[]> parameter = ((HttpServletRequest) request).getParameterMap(); , then request.getInputStream is empty But if I execute Map<String, String[]> parameter = ((HttpServletRequest) request).getParameterMap(); chain.doFilter(request, response); , the next filter in the chain receives the body ( as I expect it ) I don't understand this behaviour Regards >> >> I've seen some posts where they open a HttpURLConnection to remote >> server and send the request. This is right for me, but I'd would like >> if there is another way ( easier ) to implement it. >> > > Hi. > > The only easier way is to do your proxying before the request even gets to > Tomcat (e.g. via an Apache httpd front-end, which conditionally proxies to > Tomcat or to the other webserver). That is easier, because Apache httpd > already has well-tested and widely-used proxy modules built-in. But of > course it depends on whether the Apache front-end would be able to test the > "parameter" you are referring to. > (It can do that kind of thing via Apache directives such as "SetEnvIf", and > via mod_rewrite). > > For Tomcat, there is no such ready-made Proxy webapp available, so you have > to do it yourself. > That can be relatively simple or quite complicated, depending on what the > requests are and what the proxied-to application is like. > There was a thread on this list a couple of days ago which was related to a > similar case. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org