Below is a sample code to render report to client browser(prompt out window) using Java Servlet:
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.elixirtech.ers2.client.
ERSClient;
import com.elixirtech.net.NetException;
import com.elixirtech.report2.RenderException;
import com.elixirtech.report2.runtime.IJobInfo;
import java.io.IOException;
public class RenderReportDemoWebBrowser extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
try
{
ERSClient client = new
ERSClient("localhost",8086, "admin", "");
ServletOutputStream servletOutputStream = response.getOutputStream();
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "attachment;filename=Report.pdf");
Properties props = new Properties();
IJobInfo job = client.renderReport("/ElixirSamples/Report/Charting/3D Visualization.rml",
"application/pdf", servletOutputStream, props);
servletOutputStream.flush();
servletOutputStream.close();
}
catch (RenderException e)
{
//handle the exception
} catch (NetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void main(String[] args) throws Exception
{
}
}