gpt4 book ai didi

java - 如何异步调用 Jersey 邮寄方法?

转载 作者:太空宇宙 更新时间:2023-11-04 11:42:22 24 4
gpt4 key购买 nike

如何异步进行后调用( Jersey )?我不想从此网址得到任何响应

public void callAPI(String url,int Id,long se_eln,String reportName String ,String startDate, String endDate){
Map map= new HashMap();
map.put("Id", Id);
map.put("reportName",reportNameString);
map.put("startDate", startDate);
map.put("endDate", endDate);
map.put("accountId", se_eln);
try {
//System.out.println("calling post method");
String str = new ObjectMapper().writeValueAsString(dataMismatchMap);
//
//PostMethod postMethod = new PostMethod(url);
PostMethod postMethod = new PostMethod(url);
RequestEntity requestEntity = new StringRequestEntity(str);
postMethod.setRequestEntity(requestEntity);
postMethod.setRequestHeader("Content-Type", "application/json;charset=utf-8");

HttpClient httpclient = new HttpClient();
int result = httpclient.executeMethod(postMethod);
//System.out.println("result is "+result);
webre
} catch (MalformedURLException e) {
e.printStackTrace();

} catch (IOException e) {
e.printStackTrace();
}
}

如何异步进行后调用( Jersey )?我不想从此网址得到任何响应

最佳答案

我认为有办法在 apache http 客户端中进行异步调用,因为我可以看到你已经在使用它了。最简单的是,您可以将请求调用放在简单的线程中并让它执行。如果我发现通过 http 客户端进行异步调用将更新答案...

关于java - 如何异步调用 Jersey 邮寄方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42659407/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com