java:Tomcat 9 status code 200 but response message null
<p>I have an http client that sends request to a RESTful web service and receives a response. It was working successfully when deployed in Tomcat 8. But when I tried to deploy the same client and server in Tomcat versions 8.5 and above, the server receives response code as 200 but response message is null instead of OK.</p>
<p>Below is my client code snippet</p>
<pre><code>        httpclient = HttpClientBuilder.create().build();
        postrequest.setEntity(new UrlEncodedFormEntity(urlParameters));
        HttpResponse response = httpclient.execute(postrequest);
        
        HttpEntity entity = response.getEntity();
        System.out.println(&quot;Response from server &quot;);
        System.out.println(response.getStatusLine().getStatusCode());
        System.out.println(response.getStatusLine().getReasonPhrase());
</code></pre>
<p>and my server code snippet for response is</p>
<pre><code>@POST
@Path(&quot;/download/{filename}&quot;)
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response getFile(@PathParam(&quot;filename&quot;) String file)
{
    try
    {               
        File downloadfile = new File(&quot;/home/upload/&quot;+file);

        ResponseBuilder response = Response.ok((Object) downloadfile);
        response.header(&quot;Content-Disposition&quot;, downloadfile.getName());
        
        return response.build();
            
    }
    catch(Exception e)
    {
        logger.error(&quot;Error is : &quot;+e);
        e.printStackTrace();
    }
    
    
}
</code></pre>
<p>The output I get is just</p>
<blockquote>
<p>Response from server</p>
<p>200</p>
</blockquote>
<p>It should actually be</p>
<blockquote>
<p>Response from server</p>
<p>200</p>
<p>OK</p>
</blockquote>