Class GenericMediaTypeService

java.lang.Object
io.inverno.mod.base.resource.GenericMediaTypeService
All Implemented Interfaces:
MediaTypeService

public class GenericMediaTypeService extends Object implements MediaTypeService

A generic MediaTypeService implementation.

This implementation relies on the installed FileTypeDetector implementation to determine the media type of a file.

Since:
1.0
Author:
Jeremy Kuhn
See Also:
  • Constructor Details

    • GenericMediaTypeService

      public GenericMediaTypeService()
  • Method Details

    • getForExtension

      public String getForExtension(String extension)
      Description copied from interface: MediaTypeService

      Determines the media type of the specified file extension.

      Specified by:
      getForExtension in interface MediaTypeService
      Parameters:
      extension - a file extension
      Returns:
      a media type or null if no known media type has been found for the specified file extension
    • getForFilename

      public String getForFilename(String filename)
      Description copied from interface: MediaTypeService

      Determines the media type of the specified file name.

      Specified by:
      getForFilename in interface MediaTypeService
      Parameters:
      filename - a file name
      Returns:
      a media type or null if no known media type has been found for the specified file name
    • getForPath

      public String getForPath(Path path)
      Description copied from interface: MediaTypeService

      Determines the media type of the specified path.

      Specified by:
      getForPath in interface MediaTypeService
      Parameters:
      path - a path
      Returns:
      a media type or null if no known media type has been found for the specified path
    • getForUri

      public String getForUri(URI uri)
      Description copied from interface: MediaTypeService

      Determines the media type of the specified path.

      Specified by:
      getForUri in interface MediaTypeService
      Parameters:
      uri - a URI
      Returns:
      a media type or null if no known media type has been found for the specified URI