getOutputStream() has already been called for this response java.lang.IllegalStateException: getOutp
来源:互联网 发布:淘宝客服培训ppt下载 编辑:程序博客网 时间:2024/05/22 12:18
今天在做一个用openOffice插件把office文档转换成为PDF格式,并在线预览的时候,报了这个错误,看到了一个网友的分享突然明白,原来是在线预览的方法是用流的形式输
出到前台的,然后这个方法竟然写了返回值为String。
public String transferToPDf() throws Exception{
dataMap = new HashMap<String,Object>();
String tempName = UUIDGenerator.getUUID() + ".pdf";
try {
ConvertToPDFUtils.converterFile(FilePath.FULL_UPLOAD_PATH + File.separator + saveName, FilePath.TEMP_PATH + File.separator + tempName);
readDocs(tempName,FilePath.TEMP_PATH);
} catch (Exception e) {
log.error("office转换失败:"+e);
}finally{
FileUtils.deleteFile(FilePath.TEMP_PATH + File.separator + tempName);
}
}
因为struts中,每个action方法都返回一个actionForword对象,而response是actionforword对象参数,所以就会使得response冲突,然后把action的方法返回为null就行了。
这里值得注意的是,在线读取文件一定用的是流的形式来读取的,不用返回值。
- getOutputStream() has already been called for this response java.lang.IllegalStateException: getOutp
- java.lang.IllegalStateException: getOutputStream() has already been called for this response,java.la
- java.lang.IllegalStateException: getOutputStream() has already been called for this response
- java.lang.IllegalStateException:getOutputStream() has already been called for this response的解决方法
- java.lang.IllegalStateException: getOutputStream() has already been called for this response
- java.lang.IllegalStateException: getOutputStream() has already been called for this response
- java.lang.IllegalStateException: getOutputStream() has already been called for this response
- java.lang.IllegalStateException: getOutputStream() has already been called for this response的解决办法
- java.lang.IllegalStateException: getOutputStream() has already been called for this response
- 验证码异常:java.lang.IllegalStateException: getOutputStream() has already been called for this response
- 解决异常java.lang.IllegalStateException: getOutputStream() has already been called for this response
- java.lang.IllegalStateException: getOutputStream() has already been called for this response
- java.lang.IllegalStateException: getOutputStream() has already been called for this response问题
- java.lang.IllegalStateException: getOutputStream() has already been called for this response
- java.lang.IllegalStateException: getOutputStream() has already been called for this response
- java.lang.IllegalStateException: getOutputStream() has already been called for this response完美解决方案
- struts2:java.lang.IllegalStateException: getOutputStream() has already been called for this response
- java.lang.IllegalStateException: getOutputStream() has already been called for this response
- 函数式编程
- DDR3参数分析
- Override和Overlode区别
- 将模板word中的特定字段替换(将数据导入word中)
- liunx 系统防火墙firewalld 设置
- getOutputStream() has already been called for this response java.lang.IllegalStateException: getOutp
- Dubbo Failed to save registry store file, cause: Can not lock the registry cache file
- “计算机科学与技术”专业:解放我们的大脑
- Linux下oracle数据库启动和关闭操作
- 史上最牛的css代码
- 搭建Nginx(负载均衡)+Redis(Session共享)+Tomcat集群
- ImageLoader使用的DiskLruCache硬盘缓存算法
- okhttp + RecycleView + Glide 请求网络数据及图片
- Zookeeper序列化及通信协议