您的位置首页百科词条

httpclient

httpclient

Stringresult="";

DefaultHttpClienthttpclient=newD测行某省类利道efaultHttpClient();

//设置超时事件

HttpConnectionParams.setConn来自ectionTim360问答eout(httpclient.getParams(),Const之于刚力统些混ants.CONNECTIONTIMEOUTMILL表县终环聚IS);

HttpConnectionParams.setSoTimeout(httpclient.getParams(),Constants.SOCKETTIMEOUTMILLIS);

try{

HttpG怎析年缺路保ethttpget=newHttpGet(url);

ResponseHandlerresponseHandler严行补缩死十想正赶=newBasicResponseHandler();

StringresponseBody=httpclient.execute(httpget,responseHandler);

result=responseBody;

logge很磁处著告初保r.debug("end!");

}catch(Exc死刻停斗李别架商eptione){

logger.debug("error:"+e);

}finally{

httpclient.getConnectionManager().shut赶损何皮友帮down();

}

returnresult;