我有一个服务器端代码
@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 ;
}
我正在尝试使用RestTemplate作为
来访问它 RestTemplate abc = new RestTemplate();
JasperPrint jasperPrint = abc.postForObject("http://localhost:8008/report/getJasperPrint", objectA, JasperPrint.class);
它给出错误
no suitable HttpMessageConverter found for response type [class path to jasperPrint].
我需要做的任何事情。
答案 0 :(得分:0)
传递给方法getForObject(),postForLocation()和put()并从方法返回的对象,并通过HttpMessageConverters转换为HTTP请求和HTTP响应。
我认为你需要编写自己的转换器以获得jasperprint的响应