How to use GZip in the Visual LANSA Framework

Date:10 January 2007
Product/Release:Visual LANSA Framework EPC793
Abstract:How to use GZip in the Visual LANSA Framework
Submitted By:LANSA Technical Support

What is GZip?

GZIP file compression is a standard that most HTTP servers and Web browser support. Using it can significantly reduce the size of the HTM and JS files that are created as part of VLF web browser and RAMP applications.

Framework applications are well suited to GZIP compression because the generated HTML and JS files are relatively static.

Using the option "GZIP Compression for HTML files" can create all newly generated HTML and JS files in both the normal uncompressed form and in the GZIP compressed form.

How to setup GZip in the Framework

In Visual LANSA Framework Designer mode , use the (Framework) -> (Properties) menu options and switch to the (Web Details) tab.

Enable the option called - "Use GZIP compression for HTML and JS Files" like below:

Image showing where to enable to GZip option

When this option is used all newly generated HTML and JS files will be created in BOTH the normal uncompressed format as well as in the GZIP compressed format (a compressed file has the same name as an uncompressed file ie. with the suffix of ".gz").

Some points to check:

  1. This option is for an iSeries Web Server only (it should not be used with the Windows IIS Web Server).
     
  2. When using this with an Apache Web Server ensure that it is configured correctly - so that when it returns a compressed GZIP file to the web browser it correctly informs the browser that the file is being delivered in compressed format.

How to setup in Apache Web Server

Start the Apache administrator, then invoke the "Content Settings" option and switch to the MIME tab:

Image showing the Apache administrator screen

Add file extension .gz (a GZIP file) so that it’s Content-encoding is returned to the web browser as x-gzip.

This will include --> AddEncoding x-gzip .gz into the APACHE configuration.

After adding this option to the MIME table you should shut down and restart the HTTP server instance for the change to take effect.

How to use GZip in the Framework

When you use the "Execute Framework as Web Application" dialog you may elect to execute either the normal uncompressed version or the compressed version of the Framework Application.

To use the GZIP version of the Framework Application - checked the option to "Use GZIP compressed version":

Image showing "Use GZip compression option