/*
  i-net software provides programming examples for illustration only, without warranty
  either expressed or implied, including, but not limited to, the implied warranties
  of merchantability and/or fitness for a particular purpose. This programming example
  assumes that you are familiar with the programming language being demonstrated and
  the tools used to create and debug procedures. i-net software support professionals
  can help explain the functionality of a particular procedure, but they will not modify
  these examples to provide added functionality or construct procedures to meet your
  specific needs.
  © i-net software 1998-2010
*/

package samples.servlet;

import java.util.Properties;

import com.inet.report.ReportServlet;

/**
This sample class extends the ReportServlet.
It demonstrates how to customize the HTML page generated by the ReportServlet.
The following parameters are accepted:
  title				 
  bgcolor				 
  code					 
  codebase				 
  report	   // complete report url, content of the Applet parameter: ReportName
  hasgrouptree			 
  showgrouptree		 
  hasexportbutton		 
  hasrefreshbutton		 
  hasprintbutton		 
  hastextsearchcontrols 
  hasloggingenabled	 
  cabbase				 
  archive

To use this servlet instead of the ReportServlet you need to (sample for Tomcat):
    - copy this file in: "<TOMCAT-HOME>/webapps/<SERVLET-CONTEXT>/WEB-INF/classes/" 
      ( <SERVLET-CONTEXT> is the context that you have specified in the i-net Clear Reports setup )
    - compile this class
    - replace the servlet-class "com.inet.report.ReportServlet" in the file: "TOMCAT-HOME>/webapps/<SERVLET-CONTEXT>/WEB-INF/web.xml"
      with the name of your servlet class: <servlet-class>ReportServletWithMyHTMLProperties</servlet-class>
    - call this servlet with: 
      http://<serverName>:8080/<servlet-context>/sample.rpt
       or
      http://<serverName>:8080/<servlet-context>/<url-pattern>?report=file:c:/reports/myReport.rpt
      ( <url-pattern> is configured in the file: "TOMCAT-HOME>/webapps/<SERVLET-CONTEXT>/WEB-INF/web.xml", 
      default <url-pattern>: ReportServlet ):
      http://<serverName>:8080/<servlet-context>/ReportServlet?report=file:c:/reports/myReport.rpt 
*/

public class ReportServletWithMyHTMLProperties extends ReportServlet {
    
    /** 
     * Overwrite this empty method if you want to customize the HTML
     * page the ReportServlet generates.
     * @param props The properties of the report that are specified in the report url.     
     **/
    public void checkHtmlPageProperties(Properties props) {
        // Here you can see all properties that you can read, set or change.
        // You need to set only this property that you like to change or set.
        // For all other properties will be used the values from the url or from the rpt file.
        props.put("title",             "i-net Clear Reports Viewer");
        props.put("bgcolor",           "C6C6C6");
        props.put("code",              "com.inet.viewer.ViewerApplet");
        props.put("codebase",          "http://hostname/client");
        props.put("report",            "http://hostname:9000/?file:C:/report1.rpt");
        props.put("hasgrouptree",      "false");
        props.put("showgrouptree",     "false");
        props.put("hasexportbutton",   "false");
        props.put("hasrefreshbutton",  "true");
        props.put("hasprintbutton",    "true");
        props.put("hasloggingenabled", "false");
        props.put("archive",           "http://hostname/core/ReportViewer.jar");
    }
}

