Is there a way to get post parameters from a http request in a filter but keep the input stream intact for servlet?

4.7k Views Asked by At

I am trying to fix a bug in sitebricks where it consumes the input stream in of the data of all servlets even those not using site bricks.

HiddenMethodFilter.java line:66

String methodName = httpRequest.getParameter(this.hiddenFieldName);

See http://code.google.com/p/google-sitebricks/issues/detail?id=45

2

There are 2 best solutions below

7
On BEST ANSWER

Yes you can provide your own request, see Modify request parameter with servlet filter.

Furthermore may be extending the wrong sitebricks filter might be easier than chaining.

3
On

Obivously not, since the servlet container is required to read and consume the data in the InputStream before it is able to give you the request parameters. The other way around if you consume the InputStream first, the container won't have access to the request parameters later.

Why can't you fix the bug using the suggestion in the linked issue suggesting to configure the HiddenMethodFilter only for the URLs related to Site Bricks?