~~Title: Defining and Using Application Parameters~~
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:
* Command line parameters (for desktop applications)
* URL parameters (for RIA und web Applications)
* HTML file with special TAGs (for RIA und web applications)
* Deployment descriptor (for web applications)
* XML file with parameters
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¶m2=value2
== HTML file ==
In the case of an RIA application we have to consider the Java plugin´s conventions:
or
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):
...
WebLauncherServiceImpl
com.sibvisions.rad.ui.gwt.server.WebLauncherServiceImpl
param
value
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:
...
value
value2
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.