java - Get page content from Apache Commons HTTP Request -
so i'm using apache commons http make request webpage. cannot life of me figure out how actual content page, can header information. how can actual content it?
here example code:
httpget request = new httpget("http://url_here/"); httpclient httpclient = new defaulthttpclient(); httpresponse response = httpclient.execute(request); system.out.println("response: " + response.tostring());
thanks!
use httpresponse#getentity()
, httpentity#getcontent()
obtain inputstream
.
inputstream input = response.getentity().getcontent(); // read usual way.
note httpclient isn't part of apache commons. it's part of apache httpcomponents.
Comments
Post a Comment