Configuring the FileDownload Servlet

The Cúram Web Client Reference Manual provides full information on the configuration of the FileDownload servlet for the use of the FILE_DOWNLOAD WIDGET in a UIM page. For this photograph widget, the same configuration is used, but instead of letting the UIM WIDGET element generate HTML anchor tag that downloads the photograph when clicked, the photograph widget will create a HTML image tag using the same URI that displays the image within the page. The example below is representative of the FileDownload configuration that is required in curam-config.xml:

Figure 1. Example FileDownload Configuration for a Photograph
<APP_CONFIG>

  <FILE_DOWNLOAD_CONFIG>
    <FILE_DOWNLOAD PAGE_ID="Sample_photo"
        CLASS="sample.interfaces.SamplePkg.Sample_readImage_TH">
      <INPUT PAGE_PARAM="id" PROPERTY="key$concernRoleID"/>
      <FILE_NAME PROPERTY="key$concernRoleID"/>
      <FILE_DATA PROPERTY="result$concernRoleImageBlob"/>
    </FILE_DOWNLOAD>
  </FILE_DOWNLOAD_CONFIG>

</APP_CONFIG>

Each file download configuration is uniquely represented by the PAGE_ID of the FILE_DOWNLOAD element. The PAGE_ID is used when a file download is initiated directly from a UIM page by using the FILE_DOWNLOAD WIDGET. However, as the file download link is being generated by a custom widget, the only requirement is that the PAGE_ID value is unique, it does not have to correspond to an existing UIM page. The widget will use this value when generating the URI to the FileDownload servlet. The remaining configuration elements and attributes define the server facade to invoke and it's inputs and outputs. Consult the Cúram Web Client Reference Manual for information on the configuration of the FileDownload servlet

Figure 2. Example of the HTML to Show an In-line Image
<img src="../servlet/FileDownload?pageID=Sample_photo&id=101"/>

The HTML for the image element should look like the example above. The src attribute path is made up of a number of parts. The fixed path to Cúram's file download servlet is: ../servlet/FileDownload. The pageID request parameter is mandatory and must correspond to the PAGE_ID of the FILE_DOWNLOAD configuration element. The id request parameter corresponds to the INPUT configuration element. With this URI, the FileDownload servlet reads the configuration, sets the input fields of the server facade, invokes the facade and retrieves it's output fields which contain the file name and binary file data.