NutzCN Logo
问答 nutz 接收上传文件夹可以么?如可以接口 怎么做?
发布于 2394天前 作者 qq_e3b6dba3 1720 次浏览 复制 上一个帖子 下一个帖子
标签:

nutz 接收上传文件夹可以么?如可以接口 怎么做?

21 回复

问题是浏览器怎么上传呢?

{"detailMessage":"Unknow Content-Type : text/plain;charset=UTF-8","stackTrace":[{"declaringClass":"sun.reflect.NativeConstructorAccessorImpl","methodName":"newInstance0","fileName":"NativeConstructorAccessorImpl.java","lineNumber":-2}, {"declaringClass":"sun.reflect.NativeConstructorAccessorImpl","methodName":"newInstance","fileName":"NativeConstructorAccessorImpl.java","lineNumber":57}, {"declaringClass":"sun.reflect.DelegatingConstructorAccessorImpl","methodName":"newInstance","fileName":"DelegatingConstructorAccessorImpl.java","lineNumber":45}, {"declaringClass":"java.lang.reflect.Constructor","methodName":"newInstance","fileName":"Constructor.java","lineNumber":525}, {"declaringClass":"org.nutz.lang.born.ConstructorBorning","methodName":"born","fileName":"ConstructorBorning.java","lineNumber":16}, {"declaringClass":"org.nutz.lang.born.BornContext","methodName":"doBorn","fileName":"BornContext.java","lineNumber":60}, {"declaringClass":"org.nutz.lang.Mirror","methodName":"born","fileName":"Mirror.java","lineNumber":927}, {"declaringClass":"org.nutz.lang.Lang","methodName":"makeThrow","fileName":"Lang.java","lineNumber":113}, {"declaringClass":"org.nutz.mvc.upload.UploadAdaptor","methodName":"getReferObject","fileName":"UploadAdaptor.java","lineNumber":178}, {"declaringClass":"org.nutz.mvc.upload.UploadAdaptor","methodName":"getReferObject","fileName":"UploadAdaptor.java","lineNumber":1}, {"declaringClass":"org.nutz.mvc.adaptor.AbstractAdaptor","methodName":"adapt","fileName":"AbstractAdaptor.java","lineNumber":197}, {"declaringClass":"org.nutz.mvc.impl.processor.AdaptorProcessor","methodName":"process","fileName":"AdaptorProcessor.java","lineNumber":28}, {"declaringClass":"org.nutz.mvc.impl.processor.AbstractProcessor","methodName":"doNext","fileName":"AbstractProcessor.java","lineNumber":44}, {"declaringClass":"org.nutz.mvc.impl.processor.ActionFiltersProcessor","methodName":"process","fileName":"ActionFiltersProcessor.java","lineNumber":40}, {"declaringClass":"org.nutz.mvc.impl.processor.AbstractProcessor","methodName":"doNext","fileName":"AbstractProcessor.java","lineNumber":44}, {"declaringClass":"org.nutz.mvc.impl.processor.ModuleProcessor","methodName":"process","fileName":"ModuleProcessor.java","lineNumber":99}, {"declaringClass":"org.nutz.mvc.impl.processor.AbstractProcessor","methodName":"doNext","fileName":"AbstractProcessor.java","lineNumber":44}, {"declaringClass":"org.nutz.mvc.impl.processor.EncodingProcessor","methodName":"process","fileName":"EncodingProcessor.java","lineNumber":27}, {"declaringClass":"org.nutz.mvc.impl.processor.AbstractProcessor","methodName":"doNext","fileName":"AbstractProcessor.java","lineNumber":44}, {"declaringClass":"org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor","methodName":"process","fileName":"UpdateRequestAttributesProcessor.java","lineNumber":15}, {"declaringClass":"org.nutz.mvc.impl.NutActionChain","methodName":"doChain","fileName":"NutActionChain.java","lineNumber":40}, {"declaringClass":"org.nutz.mvc.impl.ActionInvoker","methodName":"invoke","fileName":"ActionInvoker.java","lineNumber":64}, {"declaringClass":"org.nutz.mvc.ActionHandler","methodName":"handle","fileName":"ActionHandler.java","lineNumber":31}, {"declaringClass":"org.nutz.mvc.NutFilter","methodName":"doFilter","fileName":"NutFilter.java","lineNumber":94}, {"declaringClass":"org.apache.catalina.core.ApplicationFilterChain","methodName":"internalDoFilter","fileName":"ApplicationFilterChain.java","lineNumber":241}, {"declaringClass":"org.apache.catalina.core.ApplicationFilterChain","methodName":"doFilter","fileName":"ApplicationFilterChain.java","lineNumber":208}, {"declaringClass":"com.ruyima.eop.controller.business.WebCrossOriginFilter","methodName":"doFilter","fileName":"WebCrossOriginFilter.java","lineNumber":86}, {"declaringClass":"org.apache.catalina.core.ApplicationFilterChain","methodName":"internalDoFilter","fileName":"ApplicationFilterChain.java","lineNumber":241}, {"declaringClass":"org.apache.catalina.core.ApplicationFilterChain","methodName":"doFilter","fileName":"ApplicationFilterChain.java","lineNumber":208}, {"declaringClass":"org.apache.catalina.core.StandardWrapperValve","methodName":"invoke","fileName":"StandardWrapperValve.java","lineNumber":219}, {"declaringClass":"org.apache.catalina.core.StandardContextValve","methodName":"invoke","fileName":"StandardContextValve.java","lineNumber":110}, {"declaringClass":"org.apache.catalina.authenticator.AuthenticatorBase","methodName":"invoke","fileName":"AuthenticatorBase.java","lineNumber":506}, {"declaringClass":"org.apache.catalina.core.StandardHostValve","methodName":"invoke","fileName":"StandardHostValve.java","lineNumber":169}, {"declaringClass":"org.apache.catalina.valves.ErrorReportValve","methodName":"invoke","fileName":"ErrorReportValve.java","lineNumber":103}, {"declaringClass":"org.apache.catalina.valves.AccessLogValve","methodName":"invoke","fileName":"AccessLogValve.java","lineNumber":962}, {"declaringClass":"org.apache.catalina.core.StandardEngineValve","methodName":"invoke","fileName":"StandardEngineValve.java","lineNumber":116}, {"declaringClass":"org.apache.catalina.connector.CoyoteAdapter","methodName":"service","fileName":"CoyoteAdapter.java","lineNumber":445}, {"declaringClass":"org.apache.coyote.http11.AbstractHttp11Processor","methodName":"process","fileName":"AbstractHttp11Processor.java","lineNumber":1115}, {"declaringClass":"org.apache.coyote.AbstractProtocol$AbstractConnectionHandler","methodName":"process","fileName":"AbstractProtocol.java","lineNumber":637}, {"declaringClass":"org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor","methodName":"run","fileName":"JIoEndpoint.java","lineNumber":316}, {"declaringClass":"java.util.concurrent.ThreadPoolExecutor","methodName":"runWorker","fileName":"ThreadPoolExecutor.java","lineNumber":1110}, {"declaringClass":"java.util.concurrent.ThreadPoolExecutor$Worker","methodName":"run","fileName":"ThreadPoolExecutor.java","lineNumber":603}, {"declaringClass":"org.apache.tomcat.util.threads.TaskThread$WrappingRunnable","methodName":"run","fileName":"TaskThread.java","lineNumber":61}, {"declaringClass":"java.lang.Thread","methodName":"run","fileName":"Thread.java","lineNumber":722}],"suppressedExceptions":[]}
	@At
	@Ok("json")
	@AdaptBy(type = UploadAdaptor.class, args = { "ioc:myUpload" })
	public Object addconfigure(@Param("cabinetid") Integer  cabinetid, 

			HttpServletResponse response) {
	

		response.setHeader("Access-Control-Allow-Origin", "*");
		return 1;
	}

第一个是报错提示;第二是写的接口

@wendal 用时间帮看看问题出在哪?

是要其他服务调用这个接口上传文件到服务端

http协议里面并无上传文件夹这一操作,但是有多个文件一起上传

这接口要怎么做?调用接口上传文件

按多文件上传来做嘛

@At
@Ok("json")
@AdaptBy(type = UploadAdaptor.class, args = { "ioc:myUpload" })
public Object addconfigure(@Param("cabinetid") Integer cabinetid,
@Param("pic") List tf,

       HttpServletResponse response) {


    response.setHeader("Access-Control-Allow-Origin", "*");
    return 1;
}

@At
@Ok("json")
@AdaptBy(type = UploadAdaptor.class, args = { "ioc:myUpload" })
public Object addconfigure(@Param("cabinetid") Integer cabinetid,
@Param("pic") List tf,

       HttpServletResponse response) {


    response.setHeader("Access-Control-Allow-Origin", "*");
    return 1;
}
	@At
	@Ok("json")
	@AdaptBy(type = UploadAdaptor.class, args = { "ioc:myUpload" })
	public Object addconfigure(@Param("cabinetid") Integer  cabinetid, 
			 @Param("pic") List<TempFile> tf,

			HttpServletResponse response) {
	
                    
		response.setHeader("Access-Control-Allow-Origin", "*");
		return 1;
	}
	

修改成最后这样?

你要跨域??

等上传ok之后再调跨域的事

我用火狐Restclient 测试,
http://wei.xboxes.cn/eop/celltest/addconfigure/

正文:
cabinetid=1&pic=121212

这样测试对么?

文件上传接口发个表单是什么意思?

我也不太清楚,那该如何测试

Restclient不会用就学,学不会就写个网页表单提交

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