Tutorial: Step 3

Install the Cewolf Servlet in your Web App

The rendering of the entire chart is finally provided via a servlet. This has to be installed in your web application. Cewolf provides a servlet class de.laures.cewolf.CewolfRenderer which does the job.
To configure your web application you have to edit the /WEB-INF/web.xml file. Add the following lines to it:

<servlet>
<servlet-name>CewolfServlet</servlet-name>
<servlet-class>de.laures.cewolf.CewolfRenderer</servlet-class>
</servlet>
Additionally you should provide a servlet-mapping to tell the container which URL maps to your Cewolf rendering servlet.
<servlet-mapping>
<servlet-name>CewolfServlet</servlet-name>
<url-pattern>/cewolf/*</url-pattern>
</servlet-mapping>
You also need to tell CeWolf to load on startup:
 <load-on-startup>1</load-on-startup>
To test the correct installation you should start your web app and try to call the rendering servlet with a browser (e.g. http://localhost:8080/myapp/cewolf?state). Cewolf should answer: "Cewolf servlet up and running." Here is a copy of the example web.xml:
<web-app>
  <servlet>
    <servlet-name>CewolfServlet</servlet-name>
    <servlet-class>de.laures.cewolf.CewolfRenderer</servlet-class>
	<!-- sets storage implementation -->
    <init-param>
        <param-name>storage</param-name>
        <param-value>de.laures.cewolf.storage.TransientSessionStorage</param-value>
    </init-param>
	<!-- sets overlib.js location relative to webapp -->
    <init-param>
        <param-name>overliburl</param-name>
        <param-value>etc/overlib.js</param-value>
    </init-param>
	<!-- turn on or off debugging logging -->
    <init-param>
        <param-name>debug</param-name>
        <param-value>true</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>CewolfServlet</servlet-name>
    <url-pattern>/cewolf/*</url-pattern>
  </servlet-mapping>

  <session-config>
    <session-timeout>1</session-timeout>
  </session-config>

  <mime-mapping>
      <extension>css</extension>
      <mime-type>text/css</mime-type>
  </mime-mapping>

  <welcome-file-list>
  	<welcome-file>
      index.html
    </welcome-file>
  	<welcome-file>
      index.htm
    </welcome-file>
  </welcome-file-list>
  
	<!-- resource-ref>
	  <description>
	    Resource reference to a factory for java.sql.Connection
	    instances that may be used for talking to a particular
	    database that is configured in the server.xml file.
	  </description>
	  <resource-ref-name>
	    jdbc/testdb
	  </resource-ref-name>
	  <res-type>
	    javax.sql.DataSource
	  </res-type>
	  <res-auth>
	    Container
	  </res-auth>
	</resource-ref -->

</web-app>

Step 4: Define the Chart in your JSP>>

SourceForge Logo