Table of Contents

It is not uncommon to pass various parameters at the launch of an application, so that they can be considered during initialization. For example, such parameters could be the log level, the look and feel, a username, etc.

There are various different ways to define application parameters, depending on the technology that is used:

Regardless of how the application parameters are defined, existing parameters are always accessed uniformly via the launcher. The following methods are defined for this purpose:

public String getParameter(String pName);
public void setParameter(String pName, String pValue);

The method for setting a parameter only changes the parameter within the application. When the application is closed, the change is lost.

Command Line Parameters

A command line parameter is either defined in the IDE at the launch of the application, or is passed directly during the manual call. The parameter should be defined as follows:

name=value

or

"name=value"
URL Parameters

If the application is launched as an RIA or web application, parameters can be attached to the URL in the usual manner:

http://hostname/index.html?param=value&param2=value2
HTML file

In the case of an RIA application we have to consider the Java plugin´s conventions:

<APPLET ...>
  <PARAM NAME = "param" VALUE = "value" />
</APPLET>

or

<EMBED ... param = "value" />

If the HTML file is used in combination with URL parameters, the HTML file´s parameters overwrite URL parameters with the same name.

Deployment Descriptor

Parameters for a web application can be defined via the Deployment Descriptor (web.xml):

...
<servlet>
  <servlet-name>WebLauncherServiceImpl</servlet-name>
  <servlet-class>com.sibvisions.rad.ui.gwt.server.WebLauncherServiceImpl</servlet-class>
 
  <init-param>
    <param-name>param</param-name>
    <param-value>value</param-value>
  </init-param>     
</servlet>

The deployment descriptor´s parameters overwrite URL or HTML file parameters with the same name.

XML File

At the start of the application, the launcher detects (optional) parameters from an XML configuration. If not defined otherwise, the file application.xml is read. The file should have the following structure:

<?xml version="1.0" encoding="UTF-8"?>
 
<application>
  ...
  <param>value</param>  
  <param2>value2</param2>  
</application>

The file should be found in the same path as the application implementation (directory, jar, URL). However, it can also be defined by the developer, either as command-line parameter (second parameter) or by setting the parameter config, e.g.: config=/package/app.xml in the URL or HTML file.

If the XML configuration is used in combination with command line, URL, or HTML parameters, the XML file parameters overwrite parameters with the same names.