瞄了一眼,nutz调用http请求的方法:平常的调用都能OK,但是接收文件流时不知道怎么写了,请大神指导一下~~~
@POST
@At("queryMjxpsz00")
@Ok("json")
public Object queryMjxpsz00(@Param("pageSize") String pageSize,
@Param("noncepage") String noncepage,@Param("gzbh") String gzbh) {
NutMap result = NutMap.NEW();
Map<String,Object> params = new HashMap<String,Object>();
Integer pcount = Integer.parseInt(noncepage);
Integer psize = Integer.parseInt(pageSize);
int start = (pcount-1)*psize+1;
int end = pcount*psize;
params.put("start",start);
params.put("end", end);
params.put("gzbh", gzbh);
int timeout=60*1000;
String ewe= Http.post("http://10.2.8.174:8780/BaanWebservice/servlet/MjxtService1", params, timeout);
List<Record> list =(List) Json.fromJson(NutType.list(Record.class), ewe);
int count = Integer.valueOf((String) list.get(list.size()-1).get("count"));
result.addv("rowCount", count).addv("dataList", list);
return result;
}
@POST
@At("loadfile")
@Ok("raw")
public Object mjxpsz01LoadFile(
@Param("file") String file) {
System.out.println("file=="+file);
Map<String,Object> params = new HashMap<String,Object>();
params.put("file",file);
int timeout=60*1000;
Request request=Request.create("http://10.2.8.174:8780/BaanWebservice//servlet/MjxtService4",METHOD.POST);
request.getHeader().set("Content-Type", "APPLICATION/OCTET-STREAM");
request.setData(Json.toJson(params,JsonFormat.compact()));
Response response=Sender.create(request).send();
return null;
}