The application environment is controlled by setting the application properties. This is done automatically by the Java and VoiceXML environment for managed applications . (See Managed and unmanaged applications.) The Java and VoiceXML environment automatically retrieves the settings for the application environment, such as locale, from the configuration file. These application properties are returned in the form of an ApplicationProperties object (see The ApplicationProperties class). The Java and VoiceXML environment then invokes the WVRApplication.setAppplicationProperties() method to set the properties within the application.
Your application code must access these application properties in order to create a usable WVR object later on, to represent the base Blueworx Voice Response system. To access the application properties, use the WVRApplication.getApplicationProperties() method.
public class MyVoiceApp extends WVRApplication { public void voiceMain() throws WVRException { // Retrieve the application properties that have been loaded // automatically from the configuration file ApplicationProperties appProperties = this.getApplicationProperties(); // The application properties will be used later on to create the WVR // object that makes or receives the telephone calls . . . } . . . }
For unmanaged applications, the application properties are not loaded automatically. (See Managed and unmanaged applications.) In this case, you must define them within your application. To do this, create an ApplicationProperties object directly, with properties according to your environment.
public class MyVoiceApp extends WVRApplication { public void voiceMain() throws WVRException { // Create the application properties object ApplicationProperties appProperties = new ApplicationProperties(); // The application properties will be used later on to create the WVR // object that makes or receives the telephone calls . . . } . . . }
public class MyVoiceApp extends WVRApplication { public void voiceMain() throws WVRException { // Retrieve the application properties that have been loaded automatically // from the configuration file ApplicationProperties appProperties = this.getApplicationProperties(); // If the application properties are null (application is unmanaged), then // set the properties manually if (appProperties == null) { // Create the application properties object ApplicationProperties appProperties = new ApplicationProperties(); } // The application properties will be used later on to create the WVR // object that makes or receives the telephone calls. . . . } . . . }