Configuration
Æjaks needs two parameters in order to run an application:
- AEJAKS_LIB_PATH - the path to the directory of script(s).
-
AEJAKS_SCRIPT_NAME - specific script to run for the application.
In addition, three other parameters can be specified for other behaviors:
- AEJAKS_SYSTEM_ENCODING - specifies the character encoding of the script(s).
- AEJAKS_LOG_CONFIG_FILE - specifies a Log4J configuration file to set logging behavior.
-
TCLLIBPATH - used by the JTcl interpreter to find other Tcl library packages.
There are several ways in which to specify these values. The first value found for each variable is used.
- AEJAKS_LIB_PATH
-
System property
specified when starting the servlet container:
java -DAEJAKS_LIB_PATH=/my/app_dir -jar jetty/start.jar
-
web.xml
embedded in the aejaks.war (or other .war) file. If specifed in web.xml, it must be a context-param:<context-param> <param-name>AEJAKS_LIB_PATH</param-name> <param-value>/home/apps</param-value> </context-param>
AEJAKS_LIB_PATH may point to either a directory in the file system, or resource directory on the CLASSPATH. When AEJAKS_LIB_PATH refers to a file system directory, the path name should begin with / or ./ to indicate absolute or relative paths, respectively. When a resource is specified, the pathname should begin with resource:/. In this case, the application script will typically be included in the aejaks.war file. For example, if AEJAKS_LIB_PATH is defined as resource:/app, then a directory should be created in the war file as WEB-INF/classes/app. Application scripts should be placed in that directory.
- AEJAKS_SCRIPT_NAME
-
URL request parameter AEJAKS_SCRIPT_NAME
specified on the URL that points to the application context. AEJAKS_SCRIPT_NAME='*' must have been set as a System property or web.xml parameter:
http://www.myserver.foo/aejaks/app?AEJAKS_SCRIPT_NAME=order.tcl
-
System property
specified when starting the servlet container. If using the URL request parameter to specifiy a script name, set the value as *:
java -DAEJAKS_SCRIPT_NAME=cool_app.tcl -jar jetty/start.jar
java -DAEJAKS_SCRIPT_NAME='*' -jar jetty/start.jar
-
web.xml
embedded in the aejaks.war (or other .war) file. If using the URL request parameter to specifiy a script name, set the value as *. Note that this parameter is an init-param child element of the servlet element.<servlet> <servlet-name>Aejaks</servlet-name> <servlet-class>org.aejaks.servlet.AejaksServlet</servlet-class> <init-param> <param-name>AEJAKS_SCRIPT_NAME</param-name> <param-value>awesome_app.tcl</param-value> </init-param> </servlet>
-
Default is Servlet name (from the web.xml file), plus ".tcl" extension.
If the servlet name in the web.xml file is OrderApp, then the script to invoke will be OrderApp.tcl.
- AEJAKS_SYSTEM_ENCODING
-
System property
specified when starting the servlet container:
java -DAEJAKS_SYSTEM_ENCODING=utf-8 -jar jetty/start.jar
-
web.xml
embedded in the aejaks.war (or other .war) file. If specifed in web.xml, it must be a context-param:<context-param> <param-name>AEJAKS_SYSTEM_ENCODING</param-name> <param-value>utf-8</param-value> </context-param>
AEJAKS_SYSTEM_ENCODING is used to specify a character encoding for the Tcl scripts. Particularly useful for Asian and other languages when string literals in scripts are not escaped.
-
AEJAKS_LOG_CONFIG_FILE
This parameter specifies a Log4J configuration file to be used to configure system and application logging. The default is logs/Aejaks_Log4j.xml, relative to the servlet engine home directory. Log4J configuration files can either be in Property file format, or in XML format. If using Property file format the configuration file must have the suffix .properties, otherwise the file is assumed to be in XML format.
Logging categories include separate definitions for the Æjaks system and applications. System logging are configurable by Æjaks class name categories, such as org.aejaks.servlet and org.aejaks.
Applications can log messages to the aejaks_script category by invoking the Window method . log or command Log with arguments level message.
To configure logging for specific needs, refer to the Log4J documentation at http://logging.apache.org/log4j/1.2/index.html and http://logging.apache.org/log4j/1.2/manual.html. Log4J XML configuration documenation is available at: http://wiki.apache.org/logging-log4j/Log4jXmlFormat.
This parameter can only be set as a system property:
java -DAEJAKS_LOG_CONFIG_FILE=logs/Aejaks_Logj4.xml -jar jetty/start.jar
-
TCLLIBPATH
TCLLIBPATH is used by the JTcl interpreter to find other Tcl library packages that may be used. Unlike other PATH-type environment variables, TCLLIBPATH is space separated.
This parameter can only be set as a system property:
java -DTCLLIBPATH=/opt/tcl/lib -jar jetty/start.jar