NutzCN Logo
问答 tomcat bin目录
发布于 2352天前 作者 啊哈 1601 次浏览 复制 上一个帖子 下一个帖子
标签:

tomcat bin目录下有多个org.nutz.mvc.upload.UploadingContext@1222类似这样的文件夹,大小占了几十G,能清理掉吗?

11 回复

能删

什么版本的nutz?? 感觉是upload.js写错了

PS: 那是临时文件夹, 除非你把临时文件夹当最终文件用了

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' } ] 
		}
};

完全不知道为什么会在bin目录下

搜一下java代码里面的UploadAdaptor, 感觉是某个配置把UploadAdaptor实例当成临时文件的路径

话说, ~/nutz/blog/upload/tmps 下面有文件吗?

我所有带上传的都是这个

	@AdaptBy(type = MyUploadAdaptor.class, args = { "${app.root}/WEB-INF/tmp" })

那这个myUpload 是啥用途?? 根本没用到??

@AdaptBy(type = MyUploadAdaptor.class, args = { "${app.root}/WEB-INF/tmp" }) 应该没走upload.js吧?

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);
}
}

}

```

删掉,看看报啥错误就知道了

添加回复
请先登陆
回到顶部