How to get a response to HTTPClient from a Servlet which is called from the HTTPClient?
<p>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. </p>

<p>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.</p>

<pre><code>HttpClient client = new DefaultHttpClient();
HttpPost method = new HttpPost("http://localhost:9090/drools-guvnor/KeystoneServlet");
HttpEntity entity = method.getEntity();
List&lt;BasicNameValuePair&gt; nvps = new ArrayList&lt;BasicNameValuePair&gt;();
nvps.add(new BasicNameValuePair("directory", directory));
nvps.add(new BasicNameValuePair("username", username));
nvps.add(new BasicNameValuePair("password", password));
method.setEntity(new UrlEncodedFormEntity(nvps));
ResponseHandler responseHandler = new BasicResponseHandler();
HttpResponse response = client.execute(method, responseHandler);
System.out.println("responseBody: "+responseHandler.handleResponse(response));
</code></pre>

<p>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.</p>

<p>Any assistance on the same will be highly appreciated.</p>
