Size limit with spring MVC POST form?

柔情痞子 提交于 2021-02-16 14:26:09

问题


I have a form :

<form:form modelAttribute="zgImport" action="${importAfterValidationUsers}" method="POST" name="ImportForm" >

in which I display csv content (one line per user). My controller method get the object :

public void importAfterValidationUsers(@ModelAttribute ("zgImport") ZgImport zgImport, ActionRequest request, ActionResponse response) {

Problem is : if I have many lines (more than 670) the object "zgImport" that I get in my controller is not fully filed, I miss some data. Is there a limit to the POST? Or with the mapping ?


回答1:


POST request body size is usually limited by server and can be configured.

The maximum size in bytes of the POST which will be handled by the container FORM URL parameter parsing. The limit can be disabled by setting this attribute to a value less than or equal to 0. If not specified, this attribute is set to 2097152 (2 megabytes).

Source : https://tomcat.apache.org/tomcat-5.5-doc/config/http.html




回答2:


The size limitation on the file which Spring will be handle is being configured in the server settings.




回答3:


The body of a request (POST) is normally limited by the server on a byte size basis in order to prevent a type of DoS attack. The most common server setting is 2MB, though all popular servers allow this to be increased or decreased via a setting file or panel. Edit Tomcat's server.xml. In the element, add an attribute maxPostSize and set a larger value (in bytes) to increase the limit.

More info at https://tomcat.apache.org/tomcat-5.5-doc/config/http.html



来源:https://stackoverflow.com/questions/30077145/size-limit-with-spring-mvc-post-form

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!