java/cewolf-1.0/src/site/tutorial/step3.html
author František Kučera <franta-hg@frantovo.cz>
Sat, 28 Feb 2009 21:31:02 +0100
changeset 1 639991d0808a
permissions -rw-r--r--
Rozbalená knihovna verze 1.0
     1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
     2 <html>
     3 <head>
     4   <title>Cewolf Tutorial(3): Install the Cewolf Servlet in your Web
     5 Application</title>
     6   <meta name="author" content="Guido Laures">
     7   <link href="../cewolf.css" rel="stylesheet" type="text/css">
     8 </head>
     9 <body>
    10 <h1>Tutorial: Step 3</h1>
    11 <h2>Install the Cewolf Servlet in your Web App</h2>
    12 <p> The rendering of the entire chart is finally provided via a servlet.
    13 This has to be installed in your web application. Cewolf provides a
    14 servlet class <tt>de.laures.cewolf.CewolfRenderer</tt> which does the
    15 job.<br>
    16 To configure your web application you have to edit the <tt>/WEB-INF/web.xml</tt>
    17 file. Add the following lines to it:<br>
    18 </p>
    19 <pre>&lt;servlet&gt;<br>    &lt;servlet-name&gt;CewolfServlet&lt;/servlet-name&gt;<br>    &lt;servlet-class&gt;de.laures.cewolf.CewolfRenderer&lt;/servlet-class&gt;<br>&lt;/servlet&gt;<br></pre>
    20 Additionally you should provide a servlet-mapping to tell the container
    21 which URL maps to your Cewolf rendering servlet.<br>
    22 <pre>&lt;servlet-mapping&gt;<br>    &lt;servlet-name&gt;CewolfServlet&lt;/servlet-name&gt;<br>  
    23   &lt;url-pattern&gt;/cewolf/*&lt;/url-pattern&gt;<br>&lt;/servlet-mapping&gt;<br></pre>
    24   
    25   You also need to tell CeWolf to load on startup:
    26   <pre> &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;</pre>
    27 To test the correct installation you should start your web app and try
    28 to call the rendering servlet with a browser (e.g.
    29 http://localhost:8080/myapp/cewolf?state). Cewolf should answer: "Cewolf
    30 servlet up and running."
    31 
    32 Here is a copy of the example web.xml:
    33 <pre>&lt;web-app&gt;
    34   &lt;servlet&gt;
    35     &lt;servlet-name&gt;CewolfServlet&lt;/servlet-name&gt;
    36     &lt;servlet-class&gt;de.laures.cewolf.CewolfRenderer&lt;/servlet-class&gt;
    37 	&lt;!-- sets storage implementation --&gt;
    38     &lt;init-param&gt;
    39         &lt;param-name&gt;storage&lt;/param-name&gt;
    40         &lt;param-value&gt;de.laures.cewolf.storage.TransientSessionStorage&lt;/param-value&gt;
    41     &lt;/init-param&gt;
    42 	&lt;!-- sets overlib.js location relative to webapp --&gt;
    43     &lt;init-param&gt;
    44         &lt;param-name&gt;overliburl&lt;/param-name&gt;
    45         &lt;param-value&gt;etc/overlib.js&lt;/param-value&gt;
    46     &lt;/init-param&gt;
    47 	&lt;!-- turn on or off debugging logging --&gt;
    48     &lt;init-param&gt;
    49         &lt;param-name&gt;debug&lt;/param-name&gt;
    50         &lt;param-value&gt;true&lt;/param-value&gt;
    51     &lt;/init-param&gt;
    52     &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    53   &lt;/servlet&gt;
    54 
    55   &lt;servlet-mapping&gt;
    56     &lt;servlet-name&gt;CewolfServlet&lt;/servlet-name&gt;
    57     &lt;url-pattern&gt;/cewolf/*&lt;/url-pattern&gt;
    58   &lt;/servlet-mapping&gt;
    59 
    60   &lt;session-config&gt;
    61     &lt;session-timeout&gt;1&lt;/session-timeout&gt;
    62   &lt;/session-config&gt;
    63 
    64   &lt;mime-mapping&gt;
    65       &lt;extension&gt;css&lt;/extension&gt;
    66       &lt;mime-type&gt;text/css&lt;/mime-type&gt;
    67   &lt;/mime-mapping&gt;
    68 
    69   &lt;welcome-file-list&gt;
    70   	&lt;welcome-file&gt;
    71       index.html
    72     &lt;/welcome-file&gt;
    73   	&lt;welcome-file&gt;
    74       index.htm
    75     &lt;/welcome-file&gt;
    76   &lt;/welcome-file-list&gt;
    77   
    78 	&lt;!-- resource-ref&gt;
    79 	  &lt;description&gt;
    80 	    Resource reference to a factory for java.sql.Connection
    81 	    instances that may be used for talking to a particular
    82 	    database that is configured in the server.xml file.
    83 	  &lt;/description&gt;
    84 	  &lt;resource-ref-name&gt;
    85 	    jdbc/testdb
    86 	  &lt;/resource-ref-name&gt;
    87 	  &lt;res-type&gt;
    88 	    javax.sql.DataSource
    89 	  &lt;/res-type&gt;
    90 	  &lt;res-auth&gt;
    91 	    Container
    92 	  &lt;/res-auth&gt;
    93 	&lt;/resource-ref --&gt;
    94 
    95 &lt;/web-app&gt;
    96 </pre>
    97 
    98 <p> <a href="step4.html">Step 4: Define the Chart in your JSP&gt;&gt;</a> </p>
    99 <a height="30" target="new" href="http://sourceforge.net"><img
   100  alt="SourceForge Logo" border="0" height="30"
   101  src="http://sourceforge.net/sflogo.php?group_id=57282&amp;type=5"></a>
   102 </body>
   103 </html>