On Fri, 2011-02-11 at 01:30 -0800, CodingForever wrote:
> I appreciated.
> That is working like I want.
> You see that, i am trying to decoding html page using header and
> content(offline). And I am not a perfect about httpclient. So I could not
> find the best solution for my problem.
>
> Think that you have a,
> Header and Content(raw content(gzip,deflate,may be chunked) )
> I need a solution that , I will give header and content then reading the
> decoded output until the end of the page.
> Can you offer me a solution for this problem?
>
> Best Regards.
>
String s =
"HTTP/1.1 200 OK\r\n"
+ "Server: whatever\r\n"
+ "Date: some date\r\n"
+ "Set-Cookie: c1=stuff\r\n"
+ "Transfer-Encoding: chunked\r\n"
+ "Content-Type: text/html; charset=ISO-8859-1\r\n"
+ "\r\n"
+ "5\r\n01234\r\n5\r\n56789\r\n6\r\nabcdef\r\n0\r\n\r\n test";
SessionInputBuffer inbuffer = new SessionInputBufferMockup(s,
"US-ASCII");
HttpResponseParser parser = new HttpResponseParser(
inbuffer,
BasicLineParser.DEFAULT,
new DefaultHttpResponseFactory(),
new BasicHttpParams());
HttpResponse response = (HttpResponse) parser.parse();
EntityDeserializer deserializer = new EntityDeserializer(new
LaxContentLengthStrategy());
HttpEntity entity = deserializer.deserialize(inbuffer, response);
response.setEntity(entity);
BasicHttpContext context = new BasicHttpContext();
ResponseContentEncoding processor = new ResponseContentEncoding();
processor.process(response, context);
System.out.println(EntityUtils.toString(entity));
---
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]