COS上传到tomcat的文件不能删除,重启了tomcat之后就能删除。求帮忙如何解决tomcat对cos上传的文件的占用,谢谢tomcat
解决方案 »
- 求助,解析自定义的xml文件,在线等!谢谢
- openfire如何向用户发送消息?
- 求一小段代码,功能是输出jdbc在运行时驱动程序的路径.
- 刚学struts,有许多概念性的问题搞不清,请高人指点
- 急求Hibernate-extensions2.1.3
- 为了下载图书。大家帮帮忙!!进来的有分!!
- 找高手,看下这个国际期货的即时行情有谁做过?或者公司有这样的东西?请联系我
- 如何在jsp中embed word,excel在頁面中???
- Hibernate 有人研究过吗???大家进来探讨一下.
- 请问哪里有中文版的struts书籍下载,我卖都卖不到
- grails测试时怎么连到数据库而不是内存
- spring 注解配置事务不回滚
:MultipartRequest(javax.servlet.http.HttpServletRequest request, java.lang.String saveDirectory, int maxPostSize, FileRenamePolicy policy)
在我代码中是: MultipartRequest mulit = new MultipartRequest(request, filePath, fileMaxSize, "UTF-8", rfrp);这个mulit没有关闭流的方法。
这个链接是这个构造方法的源码:http://grepcode.com/file/repo1.maven.org/maven2/com.servlets/cos/05Nov2002/com/oreilly/servlet/MultipartRequest.java/#MultipartRequest.%3Cinit%3E%28com.oreilly.servlet.HttpServletRequest%2Cjava.lang.String%2Cint%2Ccom.oreilly.servlet.multipart.FileRenamePolicy%29
有没有人有其他建议的
public long writeTo(File fileOrDirectory) throws IOException {
long written = 0;
OutputStream fileOut = null;
try {
// Only do something if this part contains a file
if (fileName != null) {
// Check if user supplied directory
File file;
if (fileOrDirectory.isDirectory()) {
// Write it to that dir the user supplied,
// with the filename it arrived with
file = new File(fileOrDirectory, fileName);
}
else {
// Write it to the file the user supplied,
// ignoring the filename it arrived with
file = fileOrDirectory;
}
if (policy != null) {
file = policy.rename(file);
fileName = file.getName();
}
fileOut = new BufferedOutputStream(new FileOutputStream(file));
written = write(fileOut);
}
}
finally {
if (fileOut != null) fileOut.close();
}
return written;
}也关闭了文件流,使用jspSmart没出现这个问题呀, 还是找不出哪里有疑点