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