gpt4 book ai didi

java - 使用ajax请求发布大型JSON对象

转载 作者:行者123 更新时间:2023-11-30 05:42:34 28 4
gpt4 key购买 nike

我需要帮助在 angularjs 中使用 ajax 将大型 JSON 对象发布到服务器。当我使用 post 请求在 ArrayList 中发送包含大约 10000 条记录的 JSON 对象时,它被接受并且我得到了相同的响应。但是当我上传 30000 条记录或更多并尝试使用 ajax 发送它时,它返回以下错误:-

[io.undertow.request] (default task-5) UT005007: Request was not fully consumed

我该如何解决这个问题?

我正在使用 Wildfly 10 和 java 8。是否有可以增加的帖子大小参数?

最佳答案

您似乎正在使用Undertow用于接收 POST 请求。检查您的设置中 MAX_ENTITY_SIZE 选项的值是多少,也许它受到限制:

The default maximum size of a request entity. If entity body is larger than this limit then a java.io.IOException will be thrown at some point when reading the request (on the first read for fixed length requests, when too much data has been read for chunked requests). This value is only the default size, it is possible for a handler to override this for an individual request by calling io.undertow.server.HttpServerExchange.setMaxEntitySize(long size). Defaults to unlimited.

按照 this thread 中的建议这可能在 Spring 中使用 MultipartConfigFactory bean 进行配置:

@Bean
public MultipartConfigElement multipartConfigElement() {
MultipartConfigFactory factory = new MultipartConfigFactory();
factory.setMaxFileSize("100MB");
factory.setMaxRequestSize("100MB");
return factory.createMultipartConfig();
}

关于java - 使用ajax请求发布大型JSON对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55394427/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com