TIWMimeTypes

TIWMimeTypesThis class was introduced in IntraWeb XIV and it provides utility functions and MIME types used in "Content-type" header fields in HTTP responsesUnitIWMimeTypesClass hierarchyTObject -> TIWMimeTypesMethods

IsStaticFile [Public]

Declaration: class function IsStaticFile(const aFileName: string; out aMimeType: string): Boolean;

Description: Returns true if a file should be served as a static file (without session validation)

Parameters:

  • aFileName (string): Name of the file
  • out aMimeType (string): the MIME type associated with the file extension of aFileName.

Result: (Boolean) True if the file should be served as a static file and false otherwise.


GetAsString [Public]

Declaration: class function GetAsString(const aFileExtension: string): string; overload;

Description: given a file extension, returns a string containing the mime type for that file. Returns an empty string if the file extension is not known

Parameters:

  • aFileExtension (string): Extension of the file, including the dot.

Result: (string) Returns a string containing the MIME type associated with the file extension.


GetAsString [Public]

Declaration: class function GetAsString(const aMimeType: TMimeType): string; overload;

Description: given a TMimeType, returns a string containing the MIME type for that type

Parameters:

  • aMimeType (TMimeType): TMimeType

type TMimeType = (mtUnknown, mtBinary, mtJPG, mtGIF, mtPNG, mtRSS, mtXML, mtTXT, mtICO, mtHTML, mtJavaScript, mtPDF, mtZIP, mtCSS, mtMP3, mtOGG, mtWAV, mtEXE, mtFlash, mtWMV, mtMOV, mtAVI, mtMPEG, mtXSL);

Result: (string) Returns a string containing the MIME type associated with the TMimeType.


RegisterType [Public]

Declaration: class procedure RegisterType(const aFileExtension, aMimeTypeDesc: string; const aIsStatic: Boolean);

Description: Registers a new MIME type for a file extension. It may optionally add the new file extension to the static file list.

Parameters:

  • aFileExtension (string): Extension of the file, including the dot.
  • aMimeTypeDesc (string): Mime type associated with the file extension.
  • aIsStatic (Boolean): True if the file extension should be served as a static file.

UnregisterType [Public]

Declaration: class procedure UnregisterType(const aFileExtension: string);

Description: Unregister a MIME type and removes its entry from static file extensions list.

Parameters:

  • aFileExtension (string): Extension of the file, including the dot.