Evaluate Mime-Type and File Extension

Subroutine Name Executable Example Viewable Example

W3MIME-TYPE
MIMETYPE

NAT-RES?source=e3xslt2.xml&lib=sysweb3
NAT-RES?source=composing_natural_logo.jpg&lib=sysweb3

NAT-RES

Description

Natural Web Interface holds an own table for mime-type / file extension settings. This table is saved in the Natural text member MIMETYPE. The text member contains pairs of mime-type names and file extension(s):

    text/html     html htm
    text/plain    txt
    text/xml      xml
    text/richtext rtf

W3MIME-TYPE reads the internal table and offers the following translations:

  • Evaluate a mime-type for a given file extension.

  • Evaluate a file extension for a given mime-type

The functionality is used internally at the W3LOAD-RESOURCE subprogram.

Parameters
  1. W3MIME-TYPE

    W3MIME-TYPE      (A) DYNAMIC  /* i /m : requested mime-type
    W3FILE-EXTENTION (A) DYNAMIC  /* o/m : found file extension
    
  2. W3MIME-TYPE

    W3MIME-TYPE      (A) DYNAMIC  /* o/m : found mime-type
    W3FILE-EXTENTION (A) DYNAMIC  /* i /m : requested file extension
    
How To Invoke
PERFORM W3MIME-TYPE W3FILE-EXTENTION