1 回答
TA贡献1780条经验 获得超1个赞
代码有效:
import java.util.Map;
import org.drools.core.process.instance.impl.WorkItemImpl;
import org.jbpm.process.workitem.rest.RESTWorkItemHandler;
import org.kie.api.runtime.process.WorkItem;
import org.kie.api.runtime.process.WorkItemHandler;
import org.kie.api.runtime.process.WorkItemManager;
public class test {
public static void main(String[] args) {
test t=new test();
System.out.println(t.getFiles("xxx","xxx","xxx","xxx"));
}
public String getFiles(String user,String pwd,String site,String path) {
String result="Error getFiles ";
try {
RESTWorkItemHandler handler = new RESTWorkItemHandler();
WorkItemImpl workItem = new WorkItemImpl();
workItem.setParameter("Url", "https://mywebsite.com/sharing/api/v1/files"+"?path="+path);
workItem.setParameter("Method", "GET");
// workItem.setParameter("Headers", Headers); Exists ?
WorkItemManager manager = new TestWorkItemManager(workItem);
handler.executeWorkItem(workItem, manager);
int responseCode = (Integer) workItem.getResult("Status");
if(responseCode==200) {
result = (String) workItem.getResult("Result");
}
}catch(Exception e) {
result+=e.getMessage();
}
return result;
}
}
添加回答
举报