WOW File Server (WFS) is a separately licensed, fee-based addon product to the Web Object Wizard (WOW). WFS provides the user the ability to access (download) documents or any other type of file. This product is useful in many different ways. For example, a garbage company has trouble with a customer who constantly parks in front of a pickup zone. The company could send cameras with their drivers, allowing the driver to take a picture of the infraction. This picture could then be put on the database and, if the customer complained about their garbage not being picked up, could be served the file from any web browser as proof of service. Another usage scenario is that of a bank. A bank could want their customers to be able to download a .PDF of their statement monthly, rather than sending a paper copy to them. WFS will allow that customer to download their statement (and only their statement) securely from the database.

 

Click here to view a sample of the WOW File Server addon.

Features

Custom Classes

Creating a File Serving Operation

Features

With WFS files can be served in two different ways:

 

  1. Files can be served using a standard HTTP reference, for example:
    http://www.testserver.com/downlaods/checkthisout.zip
    - This would download the checkthisout.zip file
    a. A database file can hold relative and absolute references to web files and can use a HTML Reference Association operation to serve the file.
    b. The major disadvantage of this approach is SECURITY. Anyone with knowledge of the path to the file can download it by specifying it in the URL. For confidential files such as contracts, financial information and the like, this is unacceptable. WFS second feature (highlighted below) addresses this issue.
     
     
  2. Files can be served from outside the web server SECURELY. WFS includes special code that can read files anywhere on the network and send the file to the user via a browser. Using WOW row level security you can secure the files that the user is allowed to access. Using the banking example from the introduction, they would use WFS and WOW to:
    a.Secure the Application by customer id and user password
    b.Secure the Operation(s) using something like:
    - select * from x.y where custid = ???custid
    - The WFS row subclass must be assigned to this operation

 

Custom Classes

planetj.wow.fileserver.FileServerOperation - This class allows an operation to serve a file back to the user. The file can reside outside the web server and is specified in the operation code. To use create an operation as SQL. Instead of SQL put in the file name to be served such as "c:\1556invoice.xls". Set the operation class of the operation to: "planetj.wow.fileserver.FileServerOperation". When the operation is executed, this class will override and serve the file instead of running SQL. The exact file specified will be served to anyone who has access to this operation.

 

planetj.wow.fileserver.HttpFileServerRow - Custom Row that adds a row action (action will appear as link labeled as DownLoad) to each row. Set the Row Class in your operation to: "planetj.wow.fileserver.HttpFileServerRow". A field in the table needs to contain the path for the file to be served and that field must have an FD assigned with a usage ID = 300. The File path can be specifed in 2 ways:

 

1. Relative path - should include the web context (e.g. wow65), and specified like the following:wow65/documents/doc1.doc

The path then gets resolved to something like: C:\Program Files\Tomcat 5.5\webapps\wow65\documents\doc1.doc

2. Actual path (value contains a colon ":" as in F: or D:) - D:\documents\doc1.doc

If a colon is found in the path, the actual path is used "as is". Otherwise, it's treated as a relative path (path will be calculated).

 

This is the class you will want to use if each customer or user needs to be served a different file and you have the file referenced in your database.

 

planetj.wow.fileserver.IfsFileServerRow - Custom Row that adds a row action (action will appear as document icon) to each row. Set the Row Class in your operation to: "planetj.wow.fileserver.IfsFileServerRow". This custom row is needed for serving files stored in IFS on an AS400/i5/iSeries. A field in the table needs to contain the URL for the IFS file to be served and that field must have an FD assigned with a usage ID = 300.

- IFS URL example:Say your file is located in "/ROOT/myfolder/myfile.doc", the URL value should contain "/myfolder/myfile.doc".

planetj.wow.fileserver.IfsImageViewer - Writes an IFS image inline into the current response by a derived field that invokes IfsImageViewer. Invoke by coding a derived field to contain a char value similar to: http://localhost:8080/WOW/run?PJMRCLASS=planetj.wow.fileserver.IfsImageViewer?file=/home/image1.jpg

- Sample SQL for an operation:

SELECT A.*, '<img src="run?PJMRCLASS=planetj.wow.fileserver.IfsImageViewer&file=' || IFSPATH || '"/>' as D_PATH from mylib.mytable A

*Where IFSPATH is a field (in table mylib.mytable) that contains the IFS URL path value.

*D_PATH is a derived field with it's FD set to HTML Code and the data type would be VARCHAR.

 

- Supported parameters for IfsImageViewer:

  1. file - path in IFS for the file, including the file name + extension (*required)
  2. alias - i5 connection alias name to use. This parameter is optional and defaults to the metadata alias defined in the web.xml file.

Creating a File Serving Operation

Here we will go through the process of creating a File Serving operation. We will be using the planetj.wow.fileserver.HttpFileServerRow custom class to serve files to customers in 2 different ways, using a relative path as well as the actual path to the item we're serving.

 

The first step is to create a new operation. The operation (in this case at least) must contain a table that has a field containing a valid path to a file you wish to serve to the customer. The operation must have the operation type of SQL operation.

 

 

Next, we need to set the Row Class of our operation to planetj.wow.fileserver.HttpFileServerRow.

  

 

The next step to making your operation work is to access the Field Descriptors (FD) for your table. In your table you should have a field that contains a URL reference to the file you want to serve to that particular customer (row). There are 2 different ways the URL reference can be formatted to work within WFS. Click here to read about the different formats.  In this example, the field is called "Download URL" Inside the FD manager, find your field that contains the URL reference and set it's Usage ID to 300.

 

 

Now, when you run your operation, a row action should appear (called "DownLoad") that, once clicked, will serve the file to the client.