tomcat bin目录下有多个org.nutz.mvc.upload.UploadingContext@1222类似这样的文件夹,大小占了几十G,能清理掉吗?
1.b.52版本的
var ioc = {
tmpFilePool : {
type : 'org.nutz.filepool.NutFilePool',
// 临时文件最大个数为 1000 个
args : [ "~/nutz/blog/upload/tmps", 9000000 ]
},
uploadFileContext : {
type : 'org.nutz.mvc.upload.UploadingContext',
singleton : false,
args : [ { refer : 'tmpFilePool' } ],
fields : {
// 是否忽略空文件, 默认为 false
ignoreNull : true,
// 单个文件最大尺寸(大约的值,单位为字节,即 1048576 为 1M)
maxFileSize : 8388608,
// 正则表达式匹配可以支持的文件名
nameFilter : '^(.+[.])(doc|docx|txt|xls|xlsx|jpg|png|gif|jpeg|bmp)$'
}
},
myUpload : {
type : 'org.nutz.mvc.upload.UploadAdaptor',
singleton : false,
args : [ { refer : 'uploadFileContext' } ]
}
};
public class MyUploadAdaptor extends UploadAdaptor {
Log log=Logs.get();
public MyUploadAdaptor() throws IOException {
super();
}
public MyUploadAdaptor(String filePath) {
super(filePath);
}
@Override
public Map<String, Object> getReferObject(ServletContext sc,
HttpServletRequest request, HttpServletResponse response,
String[] pathArgs) {
try {
if (!"POST".equals(request.getMethod()) && !"PUT".equals(request.getMethod())) {
String str = "Not POST or PUT, Wrong HTTP method! --> " + request.getMethod();
// throw Lang.makeThrow(IllegalArgumentException.class, str);
log.info(str);
Record map=new Record();
request.getParameterMap().forEach((k,v)->{
map.put(k,v.length>1?v:v[0]);
});
return map.toPojo(NutMap.class);
}
// 看看是不是传统的上传
String contentType = request.getContentType();
if (contentType == null) {
Record map=new Record();
request.getParameterMap().forEach((k,v)->{
map.put(k,v.length>1?v:v[0]);
});
return map.toPojo(NutMap.class);
// throw Lang.makeThrow(IllegalArgumentException.class, "Content-Type is NULL!!");
}
if (contentType.contains("multipart/form-data")) { // 普通表单上传
if (log.isDebugEnabled())
log.debug("Select Html4 Form upload parser --> " + request.getRequestURI());
Uploading ing = new FastUploading();
return ing.parse(request, getContext());
}
if (contentType.contains("application/octet-stream")) { // Html5
// 流式上传
if (log.isDebugEnabled())
log.debug("Select Html5 Stream upload parser --> " + request.getRequestURI());
Uploading ing = new Html5Uploading();
return ing.parse(request, getContext());
}
// 100%是没写enctype='multipart/form-data'
if (contentType.contains("application/x-www-form-urlencoded")) {
log.warn("Using form upload ? You forgot this --> enctype='multipart/form-data' ?");
Record map=new Record();
request.getParameterMap().forEach((k,v)->{
map.put(k,v.length>1?v:v[0]);
});
return map.toPojo(NutMap.class);
}
throw Lang.makeThrow(IllegalArgumentException.class, "Unknow Content-Type : "
+ contentType);
}
catch (UploadException e) {
throw Lang.wrapThrow(e);
}
finally {
Uploads.removeInfo(request);
}
}
}
```