标签:http io sp 数据 on cti bs ad as
public static ProductView getProductDetail(String id) {
String path ="http://192.168.7.45:8080/Service/ws/product/detail/"+id;
URL url = null;
ProductView pv=null;
try {
url = new URL(path);
} catch (Exception e) {
e.printStackTrace();
}
try {
HttpURLConnection conn = (HttpURLConnection) url.openConnection();//利用HttpURLConnection对象,我们可以从网络中获取网页数据.
conn.setRequestMethod("GET");// 提交模式
conn.setDoOutput(true);
conn.connect();
ObjectMapper om=new ObjectMapper();
pv=om.readValue(conn.getInputStream(), ProductView.class);
} catch (IOException e) {
e.printStackTrace();
}
return pv;
}
标签:http io sp 数据 on cti bs ad as
原文地址:http://www.cnblogs.com/yqlwl66/p/4108401.html