Hi,

Thank you for your response. I tried a "brutal approach" like the one you
were suggesting: basically I've appended the following information within a
stringbuffer for an HTML page:
 - Status line

stringBuffer.append(httpResponse.getStatusLine()).append("\n");

 - iterated output of getAllHeaders():

Header headers[] = httpResponse.getAllHeaders();
for (Header header : headers) {
        stringBuffer.append(header.getName()).append(":
").append(header.getValue()).append("\n");
}
stringBuffer.append("\n");

- entity body content, parsed from a byte array response handler that I've
implemented

String resp = new
String(responseHandler.handleResponse(httpResponse),"UTF-8");
stringBuffer.append(resp).append("\n");


Still, the given output of while fetching an HTML web page (i.e. google.com)
is different from the telnet output. A couple of headers (i.e. the
content-length) are missing like some escaping sequences in the body.

Federico



Stephen J. Butler wrote:
> 
> On Thu, Jul 12, 2012 at 12:51 PM, andrefe <[email protected]>
> wrote:
>> Using HttpClient 4.2, I was wondering why the capability of retrieving
>> the
>> raw byte content that is parsed in a HTTP response is not supported: am I
>> missing something?
>>
>> In other words, is not possible to obtain the very same output of a GET
>> request performed via telnet relying only on HttpClient methods?
> 
> You're talking about not just the body, but all the headers? Getting
> the byte[] of the response body is pretty easy
> (response.getEntity().getContent() returns an InputStream). Don't know
> about all the socket traffic.
> 
> You can log the traffic easily, for debugging purposes, if that's what
> you're after.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 
> 
-- 
View this message in context: 
http://old.nabble.com/HttpResponse-raw-data-tp34152297p34152408.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to