com.isomorphic.servlet

## Class FileDownload

- com.isomorphic.servlet.FileDownload

-     public class FileDownload

  The FileDownload Servlet is part of the optional Network Performance package. This servlet serves files with configurable cacheing directives to minimize network traffic. It will also serve compressed versions of files when possible.

  Please contact Isomorphic (http://forums.smartclient.com) to learn more about the Network Performance package.

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `java.util.Map` | `charsets` This is a comma separated expiration mapping of the form: `mimeType:charset` This allows you to specify a character encoding for a given mimeType.
    `java.util.Map` | `expires` This is a comma separated expiration mapping of the form: `mimeType:seconds to expiry`.
    `int` | `stripPathComponents` Instructs this servlet to remove the specified number of paths components from the URI before looking for the file on disk.

- - ### Field Detail

    - #### expires

          public java.util.Map expires

      This is a comma separated expiration mapping of the form: `mimeType:seconds to expiry`. This allows you to specify how long the browser is allowed to cache the file maching a given mime type from the time the file is originally served.

      For example, to set javascript files to expire in 1 hour and gif images to expire in 1 day: `text/javascript:3600,image/gif:86400`

      The comparison is an exact match of the specified mimeType against what the container returns for the intercepted URL. So, for example, if you specified `text/javascript:3600` here, but the container was configured to return `application/x-javascript` for *.js (a common mimeType for javascript), then your expiry setting for *.js files would not apply.

    - #### charsets

          public java.util.Map charsets

      This is a comma separated expiration mapping of the form: `mimeType:charset` This allows you to specify a character encoding for a given mimeType.

      For example, to set javascript files to be served with the UTF-8 encoding, set this value to: `text/javascript:UTF-8`

      For mimeTypes that do not have a charset specified, no charset setting is applied, so the container default is used.

      The comparison is an exact match of the specified mimeType against what the container returns for the intercepted URL. So, for example, if you specified `text/javascript:UTF-8` here, but the container was configured to return `application/x-javascript` for *.js (a common mimeType for javascript), then your charset setting for *.js files would not apply.

    - #### stripPathComponents

          public int stripPathComponents

      Instructs this servlet to remove the specified number of paths components from the URI before looking for the file on disk. This is useful if you're injecting a version string into your URI that isn't actually part of the path and you can't stript this off more efficiently at a different layer (e.g. Apache mod_rewrite).