有没有办法从过滤器中的 http 请求获取 post 参数,但保持 servlet 的输入流完整?

发布于 2024-12-21 11:41:57 字数 387 浏览 1 评论 0原文

我正在尝试修复 sitebricks 中的一个错误,该错误会消耗所有 servlet 数据的输入流,甚至包括那些不使用 site bricks 的数据流。

HiddenMethodFilter.java line:66

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

请参阅 http://code.google。 com/p/google-sitebricks/issues/detail?id=45

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

兮子 2024-12-28 11:41:57

是的,您可以提供自己的请求,请参阅使用 servlet 过滤器修改请求参数

此外,扩展错误的 sitebricks 过滤器可能比链接更容易。

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.

青春有你 2024-12-28 11:41:57

显然不是,因为 servlet 容器需要读取并使用 InputStream 中的数据,然后才能为您提供请求参数。相反,如果您首先使用 InputStream,容器稍后将无法访问请求参数。

为什么不能使用链接问题中建议仅为与站点砖相关的 URL 配置 HiddenMethodFilter 的建议来修复错误?

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文