首页 > 编程知识 正文

httpclient post,java异步返回结果

时间:2023-05-04 00:09:54 阅读:137300 作者:4831

头,布尔头,冷蜗牛) throws Exception {

httpurlconnectionurlconnection=(httpurl connection ) testUrl.openConnection;

try {

urlConnection.connect (;

}catch(ioexceptione ) {

thrownewconnectexception (e.getmessage );

} finally {

urlConnection.disconnect (;

}

头头(if ) {

字符串密钥:头密钥() () ) ) ) ) ) )。

post.setheader(key,header.get ) key );

}

}

传递给HttpPost

httpclient.start (;

try{

log.info (httpasyncutilshttppostcallbackparam : )、params );

if (参数!=null ) {

post.set entity (newurlencodedformentity ) Params,HTTP.UTF_8);

}

HTPclient.execute(post,callback );

}catch(exceptione ) {

e .打印任务跟踪(;

} finally {

}

}

}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。