On 16 February 2011 09:44, CodingForever <[email protected]> wrote: > > Hi, there > > I handled http responses using; > ------------------------------------------------------------------------ > 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); > System.out.println(EntityUtils.toString(response.getEntity(), HTTP.ASCII)); > > ---------------------------------------------------------- > > > I want to do same thing for user requests(get,post) > and I wrote this(below code) but the request.setEntity(Entity vs.) method > does not exist.
Because not all requests support content. You cannot add an entity to a GET method. > How can I do that ? Check and cast to BasicHttpEntityEnclosingRequest > > --------------------------------------------------------------- > SessionInputBuffer inbuffer = new SessionInputBufferMockup(bytes); > HttpRequestParser parser = new HttpRequestParser(inbuffer, > BasicLineParser.DEFAULT, new DefaultHttpRequestFactory(), new > BasicHttpParams()); > HttpRequest request = (HttpRequest) parser.parse(); > EntityDeserializer deserializer = new EntityDeserializer(new > LaxContentLengthStrategy()); > HttpEntity entity = deserializer.deserialize(inbuffer, request); > request.setEntity(entity); // ERROR > BasicHttpContext context = new BasicHttpContext(); > RequestContent processor = new RequestContent(); > processor.process(request, context); > entity = request.getEntity(); // ERROR > System.out.println(EntityUtils.toString(entity)); > -------------------------------------------------------------------------- > -- > View this message in context: > http://old.nabble.com/Request-decoding-tp30936612p30936612.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] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
