Customizing the Rhapsody web server

You can customize the Rhapsody® web server in two ways:

  • Using the Advanced Settings window
  • Modifying the webconfig.c file

About this task

To customize the Rhapsody web server, you can modify the webconfig.c file and add that file to your web-enabled Rhapsody model. The webconfig.c file is located within your Rhapsody installation directory in Share\MakeTmpl\Web. The file is clearly commented before each function. To change the web server settings, edit the argument of the function to the appropriate setting.

Because other models use this file to configure web server settings, copy the file to another directory within your web-enabled project, for example, and edit that copy of the webconfig.c file. In the process of customizing your web server, be sure to add it to the configuration of your active component from within the Rhapsody interface.

Procedure

To add the modified webconfig.c file to your web-enabled model:

  1. In the browser of a working Rhapsody model, navigate to Components > <Component Name> > Configurations. Select the active configuration.
  2. On the Features window, on the Settings tab, in the Additional Sources box, type the location of the modified webconfig.c file.

Results

The kit includes examples in <product installation folder>\Share\MakeTmpl\web\WebServerConfig.

Note: If you customize your web server using the webconfig.c file, your changes overwrite the properties set in the Advanced Settings window.

Setting a device name

To change the name of a device, modify the argument to the SetDeviceName method.

Example

For example, to change the setting of the device name to "Excellent Device," modify the call as follows:


SetDeviceName("Excellent Device");

See <product installation path>\Share\MakeTmpl\web\WebServerConfig\ChangeDeviceName for an example.

Setting a home page

Use the index.htm file to change the setting of the home page.

Setting a personalized bottom navigation

There are two ways to personalize the bottom navigation page

About this task

  • Overwrite the sign.htm file with your changed design and upload it to the Rhapsody web server (see Customizing the navigation page).
  • Use a function in the webconfig.c files to use another file for personalized bottom navigation.

    For example, to change the page name of the bottom navigation page to navigation.htm, the function and argument is as follows:
    
       SetSignaturePageUrl("navigation.htm");
    

Setting a port number

By default, the Rhapsody web server listens on port 80. To change the port number, change the argument to the SetPropPortNumber method.

Example

For example, to change the port number to 8000, use the following call:


SetPropPortNumber(8000);

Setting an automatic refresh rate

To change how frequently the Rhapsody web server refreshes changed values, use the SetRefreshTimeout function. The argument to this function holds the refresh rate, in milliseconds.

Example

For example, to change the refresh interval to every 5 seconds, use the following call:


SetRefreshTimeout(5000);

See <product installation path>\Share\MakeTmpl\web\WebServerConfig\ChangeRefreshRate for an example.

Enabling file upload

To enable the file upload capability, add the RegisterUpload function to the webconfig.c file. This function takes no arguments.

Example

See <product installation path>\Share\MakeTmpl\web\WebServerConfig\AddUploadFunctionality for an example.