如何增加POST请求的大小限制?

时间:2015-03-18 01:13:28

标签: java android post http-headers

我正在开发Android应用程序,并且使用kevinsawicki/http-request库发送复杂的json数据(使用base64编码的图像)。

我做这样的事情:

HttpRequest request =  HttpRequest.post(url)
    .header("Content-Type", "application/json")
    .send(data);

request.created()返回falserequest.code()返回http代码 413

此代码为......

  

413请求实体太大。服务器不接受请求,因为请求实体太大

因此,我需要增加大小限制才能发送大量数据。我怎样才能做到这一点?

1 个答案:

答案 0 :(得分:-1)

如果你的后端服务器是tomcat和jboss,它们的默认最大帖子大小是2M。

请参阅以下链接:

http://tomcat.apache.org/tomcat-7.0-doc/config/ajp.html https://docs.jboss.org/jbossweb/2.1.x/config/http.html

maxPostSize 
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).