Helma Logo
main list history

Version 7 by tobi on 02. November 2009, 17:47

1<strong>Due to the recent update to Jetty 6.1 in Helma the options described in this document only apply to Helma versions <=1.6.3.</strong>
2

Version 6 by tobi on 11. December 2008, 15:14

99Thus, everything located under <code>/manage/*</code> will be delegated to the manage applicationapplication – making the equivalent entries in apps.properties obsolete!
101Of course you might need further settings, e.g. for a static directory and the like. To get an idea how further servlet options are defined I included the setting of <code>cookieDomain</code> in comments. Anything, that can be set in the initialization of the <code>helma.servlet.StandaloneServletClient</code> class can be defined accordingly.

Version 5 by tobi on 11. December 2008, 14:58

23         /path/to/helma/apps/manage./apps/manage
29In fact, the main configuration of the application takes place in a another XML file called <code>web.xml</code> that needs to be stored in a special directory under in <code>./apps/nameOfHelmaApp</code> /apps/manage</code> (according to our example) – the infamous <code>WEB-INF</code> directory.
31In the case of the manage application this is the full path would be <code>/path/to/helma/apps/manage/WEB-INF/web.xml</code>, although it works with any other path as well as long as it is correctly defined in the second argument of <code><Call name="addWebApplication"></code> (ie. without the <code>WEB-INF/web.xml</code> part which is appended automatically).
35As already mentioned, web applications and their XML configuration syntax span another whole new world which I find extraordinarily hard to get adequate documentation forfor (except one likes to take on *Sun's official DTD|http://java.sun.com/dtd/web-app_2_3.dtd*). Here is a quite good one, actually written as *web.xml reference guide for Tomcat|http://wiki.metawerx.net/wiki/Web.xml*.
37For setting up a Helma application a the very reduced basic configuration looks like this:
52            helma.servlet.EmbeddedServletClientStandaloneServletClient
62        <init-param>
63            <param-name>
64              appdir
65            </param-name>
66            <param-value>
67              ./apps/manage
68            </param-value>
69        </init-param>
70        <init-param>
71            <param-name>
72              dbdir
73            </param-name>
74            <param-value>
75              ./db/manage
76            </param-value>
77        </init-param>
86To get an idea how further servlet options are defined I included the setting of <code>cookieDomain</code> in comments. Anything, that can be set in the initialization of the <code>helma.servlet.EmbeddedServletClient</code> StandaloneServletClient</code> class can be defined accordingly.

Version 4 by tobi on 20. October 2008, 15:02

Version 3 by tobi on 20. October 2008, 14:49

31In the case of the manage application this is <code>/path/to/helma/apps/manage/WEB-INF/web.xml</code>, although it works with any other path as well as long as it is correctly defined in the second argument of <code><Call name="addWebApplication"></code>></code> (ie. without the <code>WEB-INF/web.xml</code> part which is appended automatically).

Version 2 by tobi on 20. October 2008, 14:47

49            helmamanage

Version 1 by tobi on 20. October 2008, 14:39

1Besides configuring servlets and contexts in Jetty with an XML file conforming to a special syntax proprietary to Jetty the servlet API provides a more standard approach with so-called web applications and web.xml.
2
3This approach provides further control of defining contexts and additional features like e.g. filters. AFAIK, it was developed for easier deployment and exchange of such web applications between different server/servlet engines; but as all of this was designed for the mystical realm of the so-called Java enterprise edition (J2EE) I am only an educated boy making educated guesses.
4
5Following are the basic steps to define a web application with Jetty and Helma 1.x.
6
7=== Prerequisites
8
9* *Patched Helma|http://dev.helma.org/wiki/Configuring+Jetty+in+Helma+1.x/* for running Jetty with XML configuration
10* <a href="http://jetty.cvs.sourceforge.net/viewvc/\*checkout\*/jetty/Jetty/ext/jasper-runtime.jar?revision=1.13">jasper-runtime.jar</a> and <a href="http://jetty.cvs.sourceforge.net/viewvc/\*checkout\*/jetty/Jetty/ext/jasper-compiler.jar?revision=1.13">jasper-compiler.jar</a>
11
12Copy the two Jasper JAR files into the lib/ext directory of your Helma installation.
13
14=== Setting up jetty.xml
15
16Before starting up Helma we need to define the web application in jetty.xml. For a start we take the manage application as example:
17
18    <Call name="addWebApplication">
19      <Arg>
20        /manage
21      </Arg>
22      <Arg>
23        /path/to/helma/apps/manage
24      </Arg>
25  </Call>
26
27You could simply add the snippet above to the *example jetty.xml|http://dev.helma.org/wiki/Configuring+Jetty+in+Helma+1.x/* but of course it also should work with only one listener and with different settings as well.
28
29In fact, the main configuration of the application takes place in a another XML file called <code>web.xml</code> that needs to be stored in a special directory under <code>./apps/nameOfHelmaApp</code> – the infamous <code>WEB-INF</code> directory.
30
31In the case of the manage application this is <code>/path/to/helma/apps/manage/WEB-INF/web.xml</code>, although it works with any other path as well as long as it is correctly defined in the second argument of <code><Call name="addWebApplication"></code>.
32
33=== Setting up web.xml
34
35As already mentioned, web applications and their XML configuration syntax span another whole new world which I find extraordinarily hard to get adequate documentation for. Here is a quite good one, actually written as *web.xml reference guide for Tomcat|http://wiki.metawerx.net/wiki/Web.xml*.
36
37For setting up a Helma application a very reduced configuration looks like this:
38
39  <?xml version="1.0" encoding="ISO-8859-1"?>
40  <!DOCTYPE web-app
41    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
42    "http://java.sun.com/dtd/web-app_2_3.dtd">
43  <web-app>
44      <display-name>
45        test
46      </display-name>
47      <servlet>
48        <servlet-name>
49            helma
50        </servlet-name>
51        <servlet-class>
52            helma.servlet.EmbeddedServletClient
53        </servlet-class>
54        <init-param>
55            <param-name>
56              application
57            </param-name>
58            <param-value>
59              manage
60            </param-value>
61        </init-param>
62        <!-- init-param>
63            <param-name>
64              cookieDomain
65            </param-name>
66            <param-value>
67              .domain.tld
68            </param-value>
69        </init-param -->
70      </servlet>
71      <servlet-mapping>
72        <servlet-name>
73            manage
74        </servlet-name>
75        <url-pattern>
76            /*
77        </url-pattern>
78      </servlet-mapping>
79  </web-app>
80
81This defines the Helma manage application as a web application which will be displayed as "test" (e.g. in the list of available contexts) and which will be mounted under the context path defined in jetty.xml (<code>/manage</code>) considering the URL pattern <code>/*</code>.
82
83Thus, everything located under <code>/manage/*</code> will be delegated to the manage application.
84
85To get an idea how further servlet options are defined I included the setting of <code>cookieDomain</code> in comments. Anything, that can be set in the initialization of the <code>helma.servlet.EmbeddedServletClient</code> class can be defined accordingly.
86
87=== Cave at
88
89I noticed that everytime I start up Helma with a web application context I get an exception on shutdown:
90
91  Exception in thread "Thread-3" java.lang.NullPointerException
92 at helma.util.Logging.closeAll(Logging.java:167)
93 at helma.util.Logging.shutdown(Logging.java:159)
94 at helma.main.Server.stop(Server.java:543)
95 at helma.main.HelmaShutdownHook.run(HelmaShutdownHook.java:36)