Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/387.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java HeadersTooLargeException-响应标头_Java_Spring Mvc_Tomcat_Download_Http Headers - Fatal编程技术网

Java HeadersTooLargeException-响应标头

Java HeadersTooLargeException-响应标头,java,spring-mvc,tomcat,download,http-headers,Java,Spring Mvc,Tomcat,Download,Http Headers,我在Spring mvc的项目中实现了文件下载,下载文件时,tomcat 7服务器上出现以下错误: org.apache.coyote.http11.HeadersTooLargeException: An attempt was made to write more data to the response headers than there was room available in the buffer. Increase maxHttpHeaderSize on the con

我在Spring mvc的项目中实现了文件下载,下载文件时,tomcat 7服务器上出现以下错误:

org.apache.coyote.http11.HeadersTooLargeException: An attempt was made to    write more data to the response headers than there was room available in the buffer. 
Increase maxHttpHeaderSize on the connector or write less data into the response headers.
我还尝试使用server.xml中的以下代码来增加标题大小

<Connector port="8080" maxHttpHeaderSize="65536" protocol="HTTP/1.1" ... />
类文件存储数据库中的文件信息:

  public class Files {
     private int id;
     private String filename;    
     private String type;
     private byte[] file;
  }
我也尝试删除下面的行,但仍然会出现相同的错误:

        response.setHeader("Content-Disposition",
 "attachment; filename=\""+ file.getFilename() + "\"");

我也有类似的问题。在我的例子中,响应对象确实有太多的头,它们的总长度超过了
maxHttpHeaderSize
。尝试使用调试器检查您的响应对象:在Tomcat上,它可能包含一个
coyoteResponse
对象,该对象有一个
headers
字段。也许你会发现一些无关的Set Cookie头之类的东西?

有人能回答吗?
        response.setHeader("Content-Disposition",
 "attachment; filename=\""+ file.getFilename() + "\"");