【发布时间】:2016-05-26 13:12:42
【问题描述】:
void makePdfPage(String url, PdfContentByte contentByte){
com.itextpdf.text.Font sans = UtilityMethods.getSansSerifFont(14);
sans.setColor(80,147,225);
ColumnText ct = new ColumnText(contentByte);
ct.setSimpleColumn("Hello", 0, 780, 595, 830, 10, Element.ALIGN_CENTER);
try {
ct.go();
} catch (DocumentException e) {
System.out.println(e);
// TODO Auto-generated catch block
e.printStackTrace();
}
Promise<WSResponse> out = notification.call(url);
out.map(resp->{
Map<String,Object> mapp= Json.fromJson(resp.asJson().get("list"), Map.class);
PdfService.designPdf(mapp, contentByte);
return resp;
});
}
contentByte 将变为空 desginPdf
它是异步的,所以它没有 contentByte 的值,可以任何其他方式,以便我可以同步使用或任何其他方式来解决我的问题。
WSResponse resp = out.get(10000);
获取失败
【问题讨论】:
-
contentByte 是从哪里来的?它是一个全局变量吗?还是在响应块中可用?
标签: java playframework java-8 promise playframework-2.3