一、第一种方式,通过HttpClient方式,代码如下: publicstaticStringhttpGet(String url, String charset)throwsHttpException, IOException {Stringjson=null;HttpGethttpGet=newHttpGet();// 设置参数try{ httpGet.setURI(newURI(url)); }catch(URISyntaxException e) {thrownewHttpException("请求url格式错误。"+e.g...
一、第一种方式,通过HttpClient方式,代码如下: public static String httpGet(String url, String charset) throws HttpException, IOException { String json = null; HttpGet httpGet = new HttpGet(); // 设置参数 try { httpGet.setURI(new URI(url)); } catch (URISyntaxException e) { throw new Htt...