rest - java:Tomcat 9 status code 200 but response message null -


i have http client sends request restful web service , receives response. working when deployed in tomcat 8. when tried deploy same client , server in tomcat versions 8.5 , above, server receives response code 200 response message null instead of ok.

below client code snippet

        httpclient = httpclientbuilder.create().build();         postrequest.setentity(new urlencodedformentity(urlparameters));         httpresponse response = httpclient.execute(postrequest);          httpentity entity = response.getentity();         system.out.println("response server ");         system.out.println(response.getstatusline().getstatuscode());         system.out.println(response.getstatusline().getreasonphrase()); 

and server code snippet response

@post @path("/download/{filename}") @produces(mediatype.application_octet_stream) public response getfile(@pathparam("filename") string file) {     try     {                        file downloadfile = new file("/home/upload/"+file);          responsebuilder response = response.ok((object) downloadfile);         response.header("content-disposition", downloadfile.getname());          return response.build();      }     catch(exception e)     {         logger.error("error : "+e);         e.printstacktrace();     }   } 

the output just

response server

200

it should be

response server

200

ok

as per reported issue in tomcat, have stopped sending "reason phrase" tomcat 8.5 version onward.

https://bz.apache.org/bugzilla/show_bug.cgi?id=60183


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -