You can use the following methods to get access to the instance of JReport Server. JReport Server is a singleton - only one instance can exist in the system. Access to the server is through a returned RptServer object or a returned HttpRptServer object, depending on the environment of the request to get access. RptServer is designed to be instantiated in a Java Application while HttpRptServer is designed to be instantiated in a JSP page. HttpRptServer has a few extra methods available to use in the HTTP session.
Use the method jet.server.api.http.HttpUtil.initEnv(Properties props).
The method jet.server.api.http.HttpUtil.initEnv(...) creates and initializes the HttpRptServer object. If the HttpRptServer has already been started in this application, it will use the existing HttpRptServer instance. Use this method to avoid creating more than one HttpRptServer instance.
|
Call the method HttpUtil.checkLogin(HttpServletRequest req, HttpServletResponse res).
The method jet.server.api.http.HttpUtil.checkLogin(...) implicitly calls HttpUtil.initEnv(...) if necessary. So you can get the HttpRptServer after calling HttpUtil.checkLogin(...).
|