我想通过websockets传输最多16MB的大文件。当我尝试发送大于3MB的文件时,它会给我以下错误:
Warning: Unexpected error, closing connection.
java.lang.IllegalArgumentException: Buffer overflow.
at org.glassfish.tyrus.core.Utils.appendBuffers(Utils.java:346)
at org.glassfish.tyrus.core.TyrusWebSocketEngine$TyrusReadHandler.handle(TyrusWebSocketEngine.java:523)
我已经读过可以通过添加:
在glassfish-web.xml文件中更改缓冲区大小<param-name>org.glassfish.tyrus.servlet.incoming-buffer-size</param-name>
<param-value>17000000</param-value>
进入:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
<context-root>/PROJECT</context-root>
</glassfish-web-app>
但它对我来说并没有成功。还有其他选择,还是我做错了什么。