Java Enterprise Turbine
JET Documentation
(If you feel that the documentation is too short, please create a bug report)
^1 Configuration
^1.1 Jet servlet
Quick note: You can also now specify a filter
---snip---
    <filter>
        <description>The JET controller filter</description>
        <filter-name>JET</filter-name>
        <filter-class>jet.filter.JetFilter</filter-class>
        <init-param>
            <description>Config files for form and action definition</description>
            <param-name>jetconfig</param-name>
            <param-value>WEB-INF/jet-config.xml,WEB-INF/jet-config_1.xml,WEB-INF/jet-config_2.xml,
		WEB-INF/jet-config_3.xml,WEB-INF/jet-config-login.xml</param-value>
        </init-param>
    </filter>
   <filter-mapping>
      <filter-name>JET</filter-name>
      <url-pattern>*.jet</url-pattern>
   </filter-mapping>
---snap---

Configure the JetServlet in your web.xml:

Defining the servlet:

<servlet>


<description>
The JET controller servlet
</description>


Setting the JET servlet:
<servlet-name>
jet
</servlet-name>

<servlet-class>
jet.servlet.JetServlet
</servlet-class>

Set the config files to use (comma separated list):

<init-param>

<description>
Config files for form and action definition
</description>

<param-name>
jetconfig
</param-name>

<param-value>
WEB-INF/jet-config.xml
</param-value>

</init-param>

NOTE: the following init paramater is optional and deprecated - you can specify these elements in your config.xml if necessary
Setting the localizer files to use (comma separated list).
<init-param>

<description>
Files for localization of messages
</description>

<param-name>
jetlocalizers
</param-name>

<param-value>
MessageResources
</param-value>

</init-param>

NOTE: the following init paramater is optional and deprecated - you can specify these elements in your config.xml if necessary
Setting the input and output charset encoding of JET pages:
<init-param>

<description>
default charset encoding
</description>

<param-name>
jetencoding
</param-name>

<param-value>
UTF-8
</param-value>

</init-param>

NOTE: the following init paramater is optional and deprecated - you can specify these elements in your config.xml if necessary
Setting the amount of prebuild forms in jet.pool.ObjectPool:
<init-param>

<description>
Define here how many clones of the defined forms should be preloaded
</description>

<param-name>
jetformpoolsize
</param-name>

<param-value>
200
</param-value>

</init-param>

NOTE: the following init paramater is optional and deprecated - you can specify these elements in your config.xml if necessary
Same as with the form pool - just for the actions defined:
<init-param>

<description>
Define here how many clones of the defined actions should be preloaded
</description>

<param-name>
jetactionpoolsize
</param-name>

<param-value>
200
</param-value>

</init-param>

NOTE: the following init paramater is optional and deprecated - you can specify these elements in your config.xml if necessary
Setting debug modus:
<init-param>

<description>
List of host regex where debug is allowed
</description>

<param-name>
jetdebug
</param-name>

<param-value>
localhost,jet.sourceforge.net
</param-value>

</init-param>

For the most setups the debug modus would be a security reason. therefore you can define for which ip and/or server names it is allowed to access the debug modus.

Example:
http://<server>:/webapp/index.ftl?jetdebug=true

NOTE: the debug modus is session based - to disable the debug modus call a jet page with ?jetdebug=false

NOTE: the following init paramater is optional and deprecated - you can specify these elements in your config.xml if necessary
Setting ip/host which is allowed to access status informations:
<init-param>

<description>
List of host regex where status is allowed
</description>

<param-name>
jetstatus
</param-name>

<param-value>
localhost,jet.sourceforge.net
</param-value>

</init-param>


Same as above. Example:
http://<server>:/webapp/index.ftl?jetstatus

NOTE: the following init paramater is optional and deprecated - you can specify these elements in your config.xml if necessary
Setting which ip/hostis allowed to call refresh on jet:
<init-param>

<description>
List of host regex where refresh is allowed
</description>

<param-name>
jetrefresh
</param-name>

<param-value>
localhost,jet.sourceforge.net
</param-value>

</init-param>


Same as above. With "jetrefresh" you can refresh the caches, not the ObjectPools (they don't need to be refreshed). Example:
http://<server>:/webapp/index.ftl?jetrefresh=all

Available commands are:
all=refreshing all caches.
localizer=refreshing localizer cache.
resourcecache=refreshing the cache for the javascript validation etc.
resourceservlet=refreshing the caches of the resource servlet.
templateengine=refreshing the freemarker template engine.

</servlet>

Servlet mapping:

<servlet-mapping>

<servlet-name>
jet
</servlet-name>

<url-pattern>
*.jet
</url-pattern>

</servlet-mapping>


Defines the urls to use jet. You can also map that everything behind "/jet/" is jet page.

^1.2 Jet ResourcesServlet
Configure the JetResourceServlet if you want to provide images etc. via jar files:

<servlet>

<description>
The JET resource servlet
</description>

Define resource servlet:

<servlet-name>
jetresource
</servlet-name>

<servlet-class>
jet.servlet.JetResourceServlet
</servlet-class>


Setting ip/host which is allowed to activate debug informations:
<init-param>

<description>
List of host regex where debug is allowed
</description>

<param-name>
jetdebug
</param-name>

<param-value>
localhost,jet.sourceforge.net
</param-value>

</init-param>


Setting ip/host which is allowed to access status informations:
<init-param>

<description>
List of host regex where status is allowed
</description>

<param-name>
jetstatus
</param-name>

<param-value>
localhost,jet.sourceforge.net
</param-value>

</init-param>

</servlet>

Servlet mapping:
<servlet-mapping>

<servlet-name>
jetresource
</servlet-name>

<url-pattern>
/resource
</url-pattern>

</servlet-mapping>

As in the "index.ftl" example template you can refer to a image/css and other resources provided by jar files like this:

<img class="jet" src="${context}/resource?file=img/jet.gif"/>

Possible-Parameters:
file: The file to return from
type: The return type (css or jses) for jses based files
content-type: To fix content type
transfer-encoding: To specify if compressed or not
file-encoding:
fresh: If true the content get fetched from source not from cache
stripWhitespaces: If true spaced get removed
header-*: Each parameter get set as response header e.g.: "header-Expires" will set "Expires" header
connection-timeout: The timeout to use to fetch remote content
read-timeout: Timout when reading to avoid stalling connections
jetstatus: displays status information about chaching etc.

^1.3 Jet MashupProxy
Configure the JetMashupProxy if you want to provide images etc. from other domains:

<servlet>

<description>
The JET mashup proxy
</description>

Define resource servlet:

<servlet-name>
jetmashup
</servlet-name>

<servlet-class>
jet.servlet.JetMashupProxy
</servlet-class>


Setting ip/host which is allowed to access status informations:
<init-param>

<description>
List of host regex where status is allowed
</description>

<param-name>
jetstatus
</param-name>

<param-value>
localhost,jet.sourceforge.net
</param-value>

</init-param>

</servlet>

Servlet mapping:
<servlet-mapping>

<servlet-name>
jetmashup
</servlet-name>

<url-pattern>
/mashup
</url-pattern>

</servlet-mapping>

<img class="jet" src="${context}/mashup?/base/mashup?url=http://www.vespa-freunde-rosstal.de/resources/_wsb_171x137_a7ea_2.JPG&transfer-encoding=gzip&header-Expires=8640000000"/>

Possible-Parameters:
url: The url to fetch
content-type: To fix content type
transfer-encoding: To specify if compressed or not
fresh: If true the content get fetched from source not from cache
stripWhitespaces: If true spaced get removed
header-*: Each parameter get set as response header e.g.: "header-Expires" will set "Expires" header
connection-timeout: The timeout to use to fetch remote content
read-timeout: Timout when reading to avoid stalling connections

^1.4 Jet config
<JetConfig
project-name="testconfig"
>
<!-- the project name has no special meaning, it's only a identifier for the project used. //-->
    encoding: Setting the input and output charset encoding of JET pages.
    formpoolsize: Setting the amount of prebuild forms in jet.pool.ObjectPool.
    actionpoolsize: Same as with the form pool - just for the actions defined.

<JetServlet
encoding="UTF-8" formpoolsize="30" actionpoolsize="40"
>


    For the most setups the debug modus would be a security reason. therefore you can define for which ip and/or server names it is allowed to access the debug modus.
    Example:
    http://<server>:/webapp/index.ftl?jetdebug=true

    NOTE: the debug modus is session based - to disable the debug modus call a jet page with ?jetdebug=false
    
<JetDebug>
127.0.0.1
</JetDebug>


    Same as above. With "jetrefresh" you can refresh the caches, not the ObjectPools (they don't need to be refreshed). Example:
    http://<server>:/webapp/index.ftl?jetrefresh=all

    Available commands are:
    all = refreshing all caches.
    localizer = refreshing localizer cache.
    resourcecache = refreshing the cache for the javascript validation etc.
    resourceservlet = refreshing the caches of the resource servlet.
    templateengine = refreshing the freemarker template engine.
    
<JetRefresh>
127.0.0.1
</JetRefresh>


    Same as above. Example:
    http://<server>:/webapp/index.ftl?jetstatus
    
<JetStatus>
127.0.0.1
</JetStatus>


    Setting the localizer files to use (comma separated list).
    
<JetLocalizers>
MessageResourses
</JetLocalizers>

    
    With <JetInjector> you can add injectors to the method based injection.
    
<JetInjector>
jet.servlet.JetInjector
</JetInjector>

    
    As follows you can define plugins, these plugns are loaded/activated before the initialzation of the JetServlet is done. You would have access to the Servletconetxt, so you are able to load/initilaize caches etc.
    
<JetPlugin
class="jet.examples.ExamplePlugin"
/>


    As follows you can specify global exception handlers e.g. to avoid displaying errors happened in your action e.g. database down etc.
    
<JetExceptionHandler>
jet.examples.GlobalExceptionExamples#displayException
</JetExceptionHandler>


    For configuring the template engine you can specify an configurator which provides a Properties object with Freemarker parameters and some special jet parameters.
    The following properties could be set:
    
freemarker parameters
    parameter defined by jet:
    default_encoding -> the default encoding for the templates
    template_update_delay -> delay for updating templates from source
    
<FreemarkerConfigurator>
jet.freemarker.FreemarkerConfigurator#getProperties
</FreemarkerConfigurator>


</JetServlet>

  

<JetInput>

<!-- defining form elements - see 3.1 Defining forms //--!>
  
</JetInput>

...
  
<JetForm>

<!-- defining the form - see 3.1 Defining forms //--!>
  
</JetForm>

...
  
<JetAction>

<!-- defining the action - see 2.1 Defining actions //--!>
  
</JetAction>

...

In your web.xml you can specify more than one config file, so you can separate the different parts of your webapp in smaller peaces.