2015-12-09 16:35 GMT+03:00 André Warnier (tomcat) <a...@ice-sa.com>: > On 09.12.2015 14:03, Roel Storms wrote: >> >> The real requirement is being able to process the body of a request in a >> Valve without restricting the servlet to call request.getInputStream, >> getReader and getStream. I have tried by wrapping the request but some >> behavior can't be masked. It is also much more simple to implement by just >> extending the Request class and using this in Connector.createRequest(). >> >> So the actual requirement is a Valve wanting to process the body but still >> allowing the target application to call whatever processing method they >> chose. When the Valve would chose to process the body by calling >> Request.getInputStream(). The servlet wouldn't be able to call getReader >> or >> getParam anymore. I would like my Valve to be transparent in that sense. > > > I am no java nor Tomcat guru, so take this with caution : > Looking at > > http://tomcat.apache.org/tomcat-8.0-doc/config/http.html#Common_Attributes > --> maxSavePostSize > > makes me think that there is a case where tomcat saves an incoming request > body, and restores it afterward (after the authentication). Since the > authentication takes place before the webapp is called, it cannot know the > way in which the webapp is going to consume the request body. So the saved > body must be saved in such a way, that the webapp can afterward consume it > in the way it chooses. > Doesn't that provide some clue on how to solve your problem ?
+1. Good idea. To Roel: 1. See restoreRequest() method in org.apache.catalina.authenticator.FormAuthenticator on how to restore a body of a request after reading it in a Valve. The method does a lot more (as it has to reset the whole request). Your task is a bit easier. 2. Top posting is bad. http://tomcat.apache.org/lists.html#tomcat-users -> point "6." Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org