我有一个app android,它将一个get请求发送到安装在Tomcat上的servlet。我会servlet生成一个html页面作为对get请求的响应。
这是我的获取请求代码。 如何根据目标管理响应?
try {
HttpClient client = new DefaultHttpClient();
URI getURL = new URI("http://192.168.1.100:8080/MyServlet?param1="+param1+"¶m2="+param2);
Log.i("QUERY",getURL.getQuery());
HttpGet get = new HttpGet(getURL);
HttpResponse responseGet = client.execute(get);
HttpEntity resEntityGet = responseGet.getEntity();
if (resEntityGet != null) {
Log.i("GET RESPONSE",EntityUtils.toString(resEntityGet));
}
} catch (Exception e) {
e.printStackTrace();
}