我正在使用石英创建计划并运行工作。但是,我需要在其中一个工作中生成并发送jasper报告。我知道jasper服务器可用于安排报告,但我已在我的java应用程序中创建了计划。如何使用java应用程序创建报告。
我通读了这个链接 - Jasper Report scheduler
简而言之,如何让jasper服务器创建报告,让石英作业向给定用户发送电子邮件。
public class MyJob implements Job {
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
System.out.println("Context : " + context.toString());
//Can we create the jasper report here and then send using email, I have jasper server but I wanted to use the separate job to process the report and send.
}
答案 0 :(得分:1)
您可以通过REST API访问JasperServer,并在Quarz调度程序中完成剩余的工作
1)启动Quartz作业
2)在Jasper Server上进行身份验证(here is documentation)
3)通过REST API(documentation)来调用报告
4)获得结果并做任何你想做的事情(例如发送到电子邮件)
5)结束Quartz工作。