HttpClient is a client-side HTTP Transport Library, not a browser. The purpose of the HttpClient is to transmit and receive HTTP messages. HttpClient does not attempt to process the message content, execute JavaScript scripts embedded in HTML, or guess that the entity content type is equal to the HTTP transport-independent operation.
Examples of HttpClient use
//Creating an HttpClient instanceCloseablehttpclient httpClient =Httpclients.createdefault ();//create an instance of an HTTP GET requestHttpGet HttpGet =NewHttpGet ("http://www.example.com/"); //send request and get HTTP responseCloseablehttpresponse response =Httpclient.execute (httpget);Try { //print the starting line of the response messageSystem.out.println (Response.getstatusline ()); //print the header of the response messageheader[] headers =response.getallheaders (); for(Header header:headers) {System.out.println (Header.getname ()+ ": " +Header.getvalue ()); } System.out.println (""); //the body of the printed messagehttpentity entity =response.getentity (); if(Entity! =NULL) {System.out.println (entityutils.tostring (entity)); }} finally{response.close ();}
HttpClient (4.3.5)-simple example