|
i-net Clear Reports | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.inet.report.ReportServlet
public class ReportServlet
This class implements the communication between the client and the engine, that create the requested report. The ReportServlet reads the parameter from the client, sends it to the engine and sends back the requested page of the report to the client.
The ReportServlet creates a report through the following steps:
1. A client requests the following getLine:
http://localhost:9000?report=file:c:/report1.rpt&prompt0=1&SF=true&hasexportbutton=false
2. A properties object is created with contains the pairs (report .
http://localhost:9000?report=file:c:/report1.rpt&prompt0=1&SF=true), (prompt0 . 1), (SF . true)
(hasexportbutton . false).
3. doWriteHtmlPage() creates a HTML page according to the properties object. You can use the
checkHtmlPageProperties() callback and the properties object to modify the HTML code. You can also override
doWriteHtmlPage() completely.
4. The viewer starts in the client's HTML page and passes the getLine above back to the report servlet.
5. The report servlet reads the getLine passed to it from the report viewer and converts it into key/value pairs and
stores them into a newly allocated properties object. The object contains the entries: (report .
http://localhost:9000?report=file:c:/report1.rpt&prompt0=1&SF=true), (prompt0 . 1), (SF . true).
6. doExecRequest() is run and calls the checkProperties() callback which you can use to modify the report parameters.
The HttpServletRequest is passed as a second parameter to the checkProperties callback which you can use to implement
security.
7. the report template is examined, an engine object is created.
8. The checkProperties() callback with an engine parameter is run. You can use this callback to examine or change the
report using RDC. For example you can examine and change the parameter fields, the formulas etc.
9. the report is executed, the report servlet sends back the binary data to the report viewer running in the client's
HTML page.
| Method Summary | |
|---|---|
void |
afterPropertiesStoredHook(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
java.util.Properties props)
Overriding this method is useful only if you want to create a specific target format such as HTML, PDF, etc. and this format should be directly shown in the browser. |
void |
checkHtmlPageProperties(java.util.Properties props)
This callback is called before the report server creates and sends back a HTML page with the viewer embedded. |
void |
checkProperties(java.util.Properties props,
java.lang.Object req)
This callback is called right before the engine examines the report file. |
void |
checkProperties(java.util.Properties props)
This method is called by checkProperties(Properties, Object) and is equivalent to
checkProperties(props, null). |
void |
checkProperties(Engine engine,
java.util.Properties immutableProperties,
java.lang.Object req)
This callback is called right after the engine has examined the report file. |
void |
checkProperties(Engine engine,
java.util.Properties immutableProperties)
This method is called by checkProperties(Engine, Properties, Object) and is equivalent to
checkProperties(engine, prop, null). |
void |
destroy()
Close the log stream and removes the servlet. |
void |
doExecRequest(java.util.Properties props,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Executes the checkProperties() callbacks and the requested report. |
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response)
Is calling from service method after filtering. |
void |
doWriteHtmlPage(java.util.Properties props,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
When the browser has sent an initial request, this function calls the checkHtmlPageProperties() callback, creates and sends back an HTML page. |
void |
init(javax.servlet.ServletConfig config)
Initialize the servlet and logs the initialization. |
void |
service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Receive HTTP requests from the client and forward it to the methods that will execute the requested report. |
protected void |
setPropertiesChecker(PropertiesChecker propchecker)
Sets a new PropertiesChecker and therefor ignores the previous from Utils or configuration |
| Method Detail |
|---|
public void init(javax.servlet.ServletConfig config)
throws javax.servlet.ServletException
init in class javax.servlet.GenericServletconfig - servlet configuration information
javax.servlet.ServletException - if the servlet cannot be initialized.public void destroy()
destroy in class javax.servlet.GenericServlet
public void doExecRequest(java.util.Properties props,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws java.lang.Exception
props - The stored properties from the request (report=...&dll=...). Please note that when you override this
method, you will find that the props hashtable contains an object which is not a string (the object starts with
an underscore). Please ignore this element.req - The HTTP servlet requestres - The HTTP servlet response
java.lang.Exception - IOException if an input or output exception occurredcheckProperties(Properties prop, Object req),
checkProperties(Engine engine, Properties prop, Object req)
public void doWriteHtmlPage(java.util.Properties props,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws java.io.IOException,
ReportException,
javax.servlet.ServletException
// here we send back an HTML page with ... res.println( "<HTML><HEAD><TITLE> My Report Viewer </TITLE></HEAD>" );
// ... the report viewer applet embedded ... res.println( "<applet code=\"com.inet.viewer.ViewerApplet\"" ); res.println( "codebase=\"http://localhost/client\" id=ReportViewer width=100% height=100%>" ); res.println( "<param name=ReportName value=\"http://localhost:9000?report=file:c:/report1.rpt\">" ); res.println( "<param name=Archive value=\"http://localhost/core/ReportViewer.jar\">" ); res.println( "</applet>" ); res.println( "</BODY></HTML>" ); // ... done.
props - The stored properties from the request (report=...&dll=...). Please note that when you override this
method, you will find that the props hashtable contains an object which is not a string (the object's key name
starts with an underscore). Please ignore this element, as it is used internally.req - The HTTP servlet requestres - The HTTP servlet response
java.io.IOException - if there are problems with the streams
ReportException - if checking the properties causes an error
javax.servlet.ServletException - if there are servlet issues with the request or response.checkHtmlPageProperties( Properties prop )
public void afterPropertiesStoredHook(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
java.util.Properties props)
throws javax.servlet.ServletException,
java.io.IOException
props - The stored properties from the request (report=...&dll=...). Please note that when you override this
method, you will find that the props hashtable contains an object which is not a string (the object starts with
an underscore). Please ignore this element.req - The HTTP servlet requestres - The HTTP servlet response
java.io.IOException - if an input or output exception occurred
javax.servlet.ServletException - if the servlet cannot handle the request
public void checkProperties(java.util.Properties props,
java.lang.Object req)
throws ReportException
if(...) props.put("report", "file:///c:/my-report.rpt");
checkProperties in interface PropertiesCheckerprops - The user properties. All keys are lowercase.req - The HTTP servlet request, either null or HttpServlet
ReportException - If an error occurred during checking the
supplied properties with the current PropertiesChecker.
The ReportException will be send to the client and displayed in the Java viewer.PropertiesChecker.checkProperties(Engine engine, Properties prop, Object req)protected void setPropertiesChecker(PropertiesChecker propchecker)
propchecker - the new PropertiesChecker zu use
public void checkProperties(java.util.Properties props)
throws ReportException
checkProperties(Properties, Object) and is equivalent to
checkProperties(props, null).
props - The user properties.
ReportException - If an error occurred during checking the supplied properties with the current
PropertiesChecker. The ReportException will be send to the client and displayed in the Java viewer.checkProperties(Properties, Object)
public void checkProperties(Engine engine,
java.util.Properties immutableProperties,
java.lang.Object req)
throws ReportException
engine.setSchema(...);engine.setProperty(...);
checkProperties in interface PropertiesCheckerengine - The initialized engine that have parsed the rpt file already.immutableProperties - The user properties. All keys are lowercase.req - The HTTP servlet request, either null or HttpServlet
ReportException - If an error occurred during checking the
supplied properties with the current PropertiesChecker.
The ReportException will be send to the client and displayed in the Java viewer.
public void checkProperties(Engine engine,
java.util.Properties immutableProperties)
throws ReportException
checkProperties(Engine, Properties, Object) and is equivalent to
checkProperties(engine, prop, null).
engine - The initialized engine that have parsed the rpt file already.immutableProperties - The user properties.
ReportException - If an error occurred during checking the supplied properties with the current
PropertiesChecker. The ReportException will be send to the client and displayed in the Java viewer.checkProperties(Engine, Properties, Object)
public void checkHtmlPageProperties(java.util.Properties props)
throws ReportException
checkHtmlPageProperties in interface PropertiesCheckerprops - The properties of the html page. Any change to this properties object itself has absolutely no effect. All keys are lowercase.
See Example MyReportServlet_withMyHTMLProperties.java.
ReportException - If an error occurred during checking the
supplied properties with the current PropertiesChecker.PropertiesChecker.checkProperties(Engine engine, Properties prop, Object req),
PropertiesChecker.checkProperties(Properties prop, Object req)
public void service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws javax.servlet.ServletException,
java.io.IOException
service in class javax.servlet.http.HttpServletreq - HttpServletRequest object containing the requestres - HttpServletResponse object containing the response
javax.servlet.ServletException - if the servlet cannot handle the request
java.io.IOException - if an input or output exception occurred
public void doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
request - HttpServletRequest object containing the requestresponse - HttpServletResponse object containing the response
javax.servlet.ServletException - if the servlet cannot handle the request
java.io.IOException - if an input or output exception occurredservice(HttpServletRequest, HttpServletResponse)
|
i-net Clear Reports | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||