HTTP请求(POST)字段大小限制& JSP中的Request.BinaryRead [英] HTTP Request (POST) field size limit & Request.BinaryRead in JSPs

查看:334
本文介绍了HTTP请求(POST)字段大小限制& JSP中的Request.BinaryRead的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我的Java泛滥成灾,我从未做过JSP或servlet,但我正在尝试帮助其他人解决问题.

First off my Java is beyond rusty and I've never done JSPs or servlets, but I'm trying to help someone else solve a problem.

由JavaScript呈现的表单正在回发到JSP. 此表单中的某些字段的大小超过100KB. 但是,当在JSP端检索表单字段时,该字段的值将被截断为100KB.

A form rendered by JavaScript is posting back to a JSP. Some of the fields in this form are over 100KB in size. However when the form field is being retrieved on the JSP side the value of the field is being truncated to 100KB.

现在我知道ASP Request.Form中存在类似问题,可以通过使用Request.BinaryRead来解决. Java是否有等效功能?

Now I know that there is a similar problem in ASP Request.Form which can be gotten around by using Request.BinaryRead. Is there an equivalent in Java?

或者在Websphere/Apache/IBM HTTP Server中是否有解决相同问题的设置?

Or alternatively is there a setting in Websphere/Apache/IBM HTTP Server that gets around the same problem?

推荐答案

我们已解决了该问题. 事实证明,与Web服务器设置无关,并且帖子中没有任何内容被截断.

We have resolved the issue. Nothing to do with web server settings as it turned out and nothing was being truncated in the post.

发布之前,表单字段被JavaScript拆分为102399字节大小的块,并且每个块均作为值添加到表单字段,因此最终以值数组结尾. Request.Form()似乎会自动连接这些值以重现单个巨型字符串,而Java getParameter()不会. 使用getParameterValues()并根据返回的值重建字符串就可以了.

The form field prior to posting was being split into 102399 bytes sized chunks by JavaScript and each chunk was added to the form field as a value so it was ending up with an array of values. Request.Form() appears to automatically concatenate these values to reproduce the single giant string but Java getParameter() does not. Using getParameterValues() and rebuilding the string from the returned values however did the trick.

这篇关于HTTP请求(POST)字段大小限制& JSP中的Request.BinaryRead的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆