Here I am posting the JSON data using HttpClient. But I am not able to read the data on the other application. When I do request.getParameter("username"), it returns me null. Both my applications are deployed on the same server. Please tell me what I am doing wrong. Thank you
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String username = request.getParameter("username");
        String password = request.getParameter("password");
        DefaultHttpClient httpClient = new DefaultHttpClient();
        HttpPost postRequest = new HttpPost("http://localhost:8080/AuthenticationService/UserIdentificationServlet");
        postRequest.setHeader("Content-type", "application/json");
        StringEntity input = new StringEntity("{\"username\":\""+username+"\"}");
        input.setContentType("application/json");
        postRequest.setEntity(input);
        HttpResponse postResponse = httpClient.execute(postRequest);
        BufferedReader br = new BufferedReader(new InputStreamReader((postResponse.getEntity().getContent())));
        String output;
        System.out.println("Output from Server .... \n");
        while ((output = br.readLine()) != null) {
            System.out.println(output);
        }
        httpClient.getConnectionManager().shutdown();
    }
 
    