解决在weblogic上报java.net.ProtocolException: Didn't meet stated Content-Length, wrote: '146592' bytes instead of stated: '462285' by
来源:互联网 发布:mac book air截图 编辑:程序博客网 时间:2024/05/16 14:42
今天在查看weblogic服务器日志时后台报出了大量的错误,如下:
java.net.ProtocolException: Didn't meet stated Content-Length, wrote: '146592' bytes instead of stated: '462285' bytes.
at weblogic.servlet.internal.ServletOutputStreamImpl.ensureContentLength(ServletOutputStreamImpl.java:470)
at weblogic.servlet.internal.ServletResponseImpl.ensureContentLength(ServletResponseImpl.java:1176)
at weblogic.servlet.internal.ServletResponseImpl.send(ServletResponseImpl.java:1188)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2590)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
经过多次测试后找到解决办法,主要是因为在图片下载时,
bis = new BufferedInputStream(rs.getBinaryStream(img));
response.setContentLength(rs.getInt(2));
response.setBufferSize(1024);
response.setContentType("application/x-msdownload");
response.setHeader("Content-Disposition", "filename=" + InfoVariable.converu2a("img"));
ServletOutputStream op = response.getOutputStream();
byte[] b= new byte[1024];
int size=0;
while ((size = bis.read(b)) != -1)
op.write(b, 0, size);
导入到response中的字节数没有设定,可以通过增加如下设置解决此问题,
//其中rs.getInt(2)为在数据库中blob字段的大小,可以通过dbms_lob.getlength(img)函数取得
response.setContentLength(rs.getInt(2)); //注意cotentlength的大小为图片的大小
如果要是图片打不开,或者显示为乱码可以用response.resetBuffer();刷新一下缓存.
- 解决在weblogic上报java.net.ProtocolException: Didn't meet stated Content-Length, wrote: '146592' bytes instead of stated: '462285' by
- didn't meet stated Content-length,wrote:'133' bytes instead of stated '204' bytes
- 关于weblogic下java.net.ProtocolException: Didn't meet stated Content-Length, wrote: 异常
- 关于weblogic下java.net.ProtocolException: Didn't meet stated Content-Length, wrote:
- java.net.ProtocolException: Exceeded stated content-length of: '6144' bytes
- weblogic 11g java.net.ProtocolException: Exceeded stated content-length of: '13824' bytes
- 解决weblogic下报java.net.ProtocolException: Exceeded stated content-length of异常问题
- Windows部署Weblogic问题:Didn't meet stated Content-Length
- sitemesh 2.4.2在weblogic中Didn't meet stated Content-Length问题
- java.net.ProtocolException: Exceeded stated content-length of: '13824' bytes 用jspSmartUpload.jar下载 出错
- 关于weblogic下Did not meet stated content length of OutputStream异常
- Weblogic: Exceeded stated content-length
- unless otherwise stated
- java.net.ProtocolException: unexpected end of stream
- 记一次android Bug解决的曲折心路历程(java.net.ProtocolException: expected 0 bytes but received 2048)
- java.net.ProtocolException翻译
- 关于OKhttp的异常:java.net.ProtocolException: expected 6137 bytes but received 7081
- Caused by: java.lang.ClassNotFoundException: Didn't find class "net.oschina.app.AppContext" on path:
- 用BusyBox制作根文件系统
- com.opensymphony.xwork2.interceptor.ParametersInterceptor
- 将大写数字的日期转换为阿拉伯数字的方法
- 我的blog
- Spring Mail中文乱码问题
- 解决在weblogic上报java.net.ProtocolException: Didn't meet stated Content-Length, wrote: '146592' bytes instead of stated: '462285' by
- symbian日记(5)
- 左右滚动的图片代码
- ppc通过数据线与共享电脑上网
- 咱写代码的人
- 领导权变理论
- ibatis 组装SQL动态排序
- Sequence
- 情境领导模式(权变)