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.
With WFS files can be served in two different ways:
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:
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.