Is there a way to extract HttpResponse
from HttpClient()
and GetMethod
in java?
I need the HttpEntity
from the response using HttpClient
.
Anyone knows a way?
My code :
client = new HttpClient();
GetMethod get = new GetMethod(URL);
get.setDoAuthentication(true);
try{
int statusCode = client.executeMethod(get);
//parsing XML from response
//System.out.println(get.getResponseBodyAsString());
if(statusCode == 200){
System.out.println();
// here I need HttpResponse object to get HttpEntity
}
}finally{
get.releaseConnection();
}