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

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -