Trying to return JasperPrint as a return type of Server type
I have server side code like
@POST
@Path("/getJasperPrint")
public JasperPrint getReport(ReportMapper reportMapper,@Context HttpServletRequest request,@Context HttpServletResponse response) throws Exception{
jasperPrint = JasperFillManager.fillReport(jasperReport, reportMap,
DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb" + "?user=" + "admin" + "&password=" + "admin"));
return jasperPrint ;
}
I am trying to access this using RestTemplate as
RestTemplate abc = new RestTemplate();
JasperPrint jasperPrint = abc.postForObject("http://localhost:8008/report/getJasperPrint", objectA, JasperPrint.class);
It gives error
no suitable HttpMessageConverter found for response type [class path to jasperPrint].
All I need to do is here.
+3
source to share
1 answer
Spring blog source post
Objects passed and returned from the getForObject (), postForLocation (), and put () methods and are converted to HTTP requests and from HTTP responses by HttpMessageConverters.
What I think you need to write your own converter to get the answer as jasperprint
0
source to share