【发布时间】:2014-06-15 18:27:19
【问题描述】:
我们在 Tomcat 上运行 grails 2.2.4 应用程序,该应用程序与用户摄像头和击键配合使用,使用 Javascript 在客户端收集一些数据并使用 POST 发送。
在我们收集数据的视图中:
<g:form name="testResultsForm" id="testResultsForm" controller="customer" action="thankYou" method="post">
<h3>Dummy data!</h3>
<input type="text" style="visibility: hidden" name="testResults" id="testResults"/>
<button type="submit" class="btn btn-default">Submit dummy data</button>
</g:form>
在 JS 中,我们将所有相机数据分配给这个 html 元素并提交表单:
TestUtils.setValue('testResults', sendData);
$("#testResultsForm").submit();
在 grails 控制器中,我们有以下行来解析 JSON:
def data = JSON.parse(params.testResults)
一切都按预期工作,除非用户花费的时间比正常时间长并且输入了很多按键。错误看起来像:
2014-06-14 01:22:14,323 [http-8443-16] ERROR (org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver) - JSONException occurred when processing request: [POST] /qbcheck/customer/thankYou
Expected a ',' or ']' at character 524288 of {"patkey":"","test_version":"1.4","data_version":"1.3","patientid":"","test_date":"","test_duration":0,"gender":"","dob":"","fov":62,"fps":26,"scale_factor":0,"country":46,"camera_data":{"x":[353,353,353,353,3......
它总是在字符 524288 处失败。这导致我们调查数据量可能存在限制,我们查看了 Tomcat,发现它默认使用 maxpostsize 属性允许 2MB 数据。为了确定,我们仍然将其更新为更大的数字。同样,我们尝试查看 Grails 和 JS 端,但没有发现任何限制。
寻找这方面的任何指针。我们可以根据需要提供更多详细信息。
【问题讨论】:
-
@johnSmith 我们已经尝试过,正如我在问题中提到的那样没有任何成功,所以似乎限制在其他地方
-
你的tomcat是链中的第一台服务器吗?或者它前面是否有其他 httpd、代理或防火墙,可能会应用限制?
-
@cfrick,他使用 apache + tomcat,tomcat 的限制是用
maxPostSize="0"修复的,但现在在 json 解析过程中出现了某种proxy error(可能解析需要太多时间) -
一个用户正在输入 524288 个字符 - 也许客户应该事先限制 saize 和 valdiate
标签: java javascript json grails