【问题标题】:Max payload size for post request and Get response for SpringBoot Rest发布请求的最大有效负载大小和 Spring Boot Rest 的获取响应
【发布时间】:2018-05-10 13:44:44
【问题描述】:

发送后有效负载是否有最大大小?

实际上,我有一个将 json 有效负载发送到另一个微服务的服务,在 JSON 有效负载一侧,有一个保存编码字符串的字段(基本上我已经将文件转换为编码字符串并将其设置到该有效负载字段中价值)。

文件大小不固定,所以我很好奇,Post json payload 是否支持最大大小?

我知道 spring-boot 有以下属性来设置文件上传的最大大小。

spring.http.multipart.max-file-size
spring.http.multipart.max-request-size

但正如我所提到的,我不是上传文件,而是将文件转换为编码字符串并将此字符串与 json 有效负载一起发送。

那么如何设置发布请求的最大尺寸支持。

另外,在另一种情况下,我正在向微服务发送 Get 请求,然后这个微服务返回一个大的有效负载,接收有效负载大小是否有任何限制?

【问题讨论】:

  • 你找到答案了吗?

标签: spring-boot spring-rest


【解决方案1】:

这不仅取决于您指出的 spring 配置,还取决于服务器配置。

大多数服务器都有发布请求加载限制。例如,在 tomcat 中,您可以使用“maxPostSize”属性对其进行配置。引用自documentation:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-27
    • 2019-12-28
    • 1970-01-01
    • 2020-11-06
    • 1970-01-01
    • 2013-12-03
    相关资源
    最近更新 更多