一、调用样例
try {
var url = 'http://localhost:8080/jersey/webapi/dept4/formuis3josn'
var ArrayList = Java.type('java.util.ArrayList');
var heads = new ArrayList();
var NameValuePair = Java.type('com.x.base.core.project.bean.NameValuePair');
var p1 = new NameValuePair('Content-Type', 'application/json; charset=utf-8');
heads.add(p1); //设置请求头信息
var HttpConnectionClass = Java.type('com.x.base.core.project.connection.HttpConnection');
docContent = "[" + docContent + "]";
var resp = HttpConnectionClass.postAsString(url, heads, docContent); //post调用方法
print("更新索引返回:" + resp.toString());
return resp.toString();
} catch (e) {
print("发送请求出错");
print(e.printStackTrace());
return "发送请求出错";
}