I am able to successfully post to a servlet using HttpClient. However i need a boolean parameter back to the HttpClient from the servlet and am not sure how to do the same.
Earleir i was using the common-httpclient-3.1.jar.However then i was made aware of the version upgrade of httpclient to 4.0 which assists in the Response handling from HttpResponse. Now I am using httpclient.4.0.3, httpcore-4.1 and httpmime-4.1.1. The code being tried by me is as below for the HttpClient.
In the KeyStoneServlet i am able to successfully get the parameters directory, username and password. Further using these parameter am doing a further processing and am able to retrieve a boolean parameter which i want back as a response to the HttpClient. However i do not know how can i do the same. The responseBody SOP above comes blank and doesnt show me anything.
In the servlet the parameter i need is mentioned in the below code.
I am unable to understand how should i send this back to the calling httpclient. I understand that i can create a BasicHttpParam in the servlet and use the setBooleanParameter routine. But i cant retreive this param in the calling httpclient.
The SOPs above where i am trying to retrive the params come out blank. Since the SOP for Params returns the defaultValue, it prints out false. The responseBody SOP always comes up as blank
Any immediate assistance on the same will be highly appreciated.
I never heard of HTTP response parameters before. And I don't see any "setParameter" method in the HttpServletResponse specs either. Normally what people do is to parse the HTTP response to extract the data they need.
Joined: Jun 26, 2011
Paul Clapham wrote:I never heard of HTTP response parameters before. And I don't see any "setParameter" method in the HttpServletResponse specs either. Normally what people do is to parse the HTTP response to extract the data they need.
I am not mentioning regarding HttpServletResponse. The servlet is being called by a HttpClient and i was looking for a way to read through a boolean parameter which is a response from the servlet to the HttpClient.
I found the needful. Thanks everyone for the assistance. :)
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: How to return a parameter from a servlet to the calling HttpClient