2015-12-16 14:11 GMT+01:00 Christopher Schultz <ch...@christopherschultz.net >:
> Roel, > > On 12/16/15 4:56 AM, Roel Storms wrote: > > It should, if you implement parseParameter and all these other methods > > before getStream is called, in the wrapper itself. But since you haven't > > implemented HttpServletRequest.getParameter* in you example Filter, you > > will end up using Request.getParameter* which will not use > > the HttpServletRequest.getStream since it has no knowledge of this > wrapper. > > The wrapped object never uses the wrapped implementation of methods since > > it has no knowledge of the wrapping. > > I'm sorry I wasn't clear, but I was suggesting that you use my Filter as > inspiration for writing a Valve. The Valve wouldn't wrap > HttpServletRequest. Instead, it would wrap Tomcat's coyote Request > class, which *is* used to fetch the input stream (or reader). > > -chris > > Ok, first of all, sorry for the Top posting, it's a nasty habit that comes with using the Gmail webclient. Secondly, If it would wrap the Request without intercepting getParameter() then a call to HttpServletRequest.getParameter would delegate to the wrapped Request which in my case, would be a wrapped version of the original Request. But since I am not intercepting getParameter, it will result in Request.getParameter being called which leads me back to the previous e-mail. As long as I am not implementing all the methods that eventually call getStream, getInputStream and getReader, I won't get the desired behavior. I agree that your filter could be an inspiration for a Valve but it would have to cover all the methods mentioned in the previous e-mail and it wouldn't suffice to . I have several sequence diagrams explaining what I mean. https://www.dropbox.com/s/ebjs6ixpyqs742n/getParameter.jpg?dl=0 https://www.dropbox.com/s/c9sj00nwqcs9l7y/getParameter2.jpg?dl=0 The first diagram describes what happens if you intercept getReader, getInputStream and getStream but don't intercept getParameter. The second diagram shows the interaction as it's supposed to happen but requires the wrapper implementing all these methods without delegating them to the wrapped Request. The other alternative is extending Request with an implementation of getStream without implementations for getParameter, parseParameters or readPostBody. This would result in the following (if I use dynamic binding correctly): https://www.dropbox.com/s/0a3k9qqzonicjvf/getParameter3.jpg?dl=0 I will also look into what Konstantin suggested. -------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >