将大文件(> 2GB)上传到 websphere

Uploading huge files (> 2GB) to websphere

我在 websphere 8.5.5 上部署了一个网络应用程序,我想上传一个巨大的文件(~3 GB),但我的问题是 content-lengthnull 如果文件大小超过 (2GB),尽管当我在 tomcat 上部署相同的应用程序时,一切都按预期工作。

HttpServletRequest httpRequest = (HttpServletRequest) request;
    ServletFileUpload sfu = new ServletFileUpload(new DiskFileItemFactory());

    sfu.setSizeMax(-1);
    httpRequest.getHeader(FileUploadBase.CONTENT_LENGTH); //This returns null for huge files !

这是 WAS 8.5.5 的一个小问题,如果内容长度大于 2GB httpRequest.getContentLength() 将按预期 return -1 但 httpRequest.getHeader("Content-Length") 将 return 为空。

问题已通过对 Servlet 3.1 的支持得到解决,Servlet 3.1 已添加到 WebSphere Application Server Liberty 配置文件 8.5.5.4 中,并且在此处提供的 WebSphere Application Sever V9 beta 中也已解决:https://developer.ibm.com/wasdev/blog/2015/10/17/websphere-application-server-v9-beta/

在 8.5.5 中,您可以通过将内容长度设置为查询参数或将其包含在请求的路径信息中来解决此问题。或者,如果您有支持,您可以联系 IBM 服务以打开 PMR 并请求修复。