HttpClient httpClient = new DefaultHttpClient();
// HttpGet get = new HttpGet("http://local:8084");
HttpPost get = new HttpPost("http://localhost:8080");
HttpResponse response = httpClient.execute(get);
HttpEntity entity = response.getEntity();
String xmlString = null;
if (entity != null) {
entity = new BufferedHttpEntity(entity);
InputStream in = entity.getContent();
byte[] read = new byte[1024];
byte[] all = new byte[0];
int num;
while ((num = in.read(read)) > 0) {
byte[] temp = new byte[all.length + num];
System.arraycopy(all, 0, temp, 0, all.length);
System.arraycopy(read, 0, temp, all.length, num);
all = temp;
}
System.out.println(new String(all));
xmlString = new String(all);
in.close();
}
get.abort();
|