Class MediaTypeFactory

    • Method Detail

      • getMediaType

        public static Optional<MediaTypegetMediaType​(@Nullable
                                                       Resource resource)
        Determine a media type for the given resource, if possible.
        Parameters:
        resource - the resource to introspect
        Returns:
        the corresponding media type, or null if none found
      • getMediaType

        public static Optional<MediaTypegetMediaType​(@Nullable
                                                       String filename)
        Determine a media type for the given file name, if possible.
        Parameters:
        filename - the file name plus extension
        Returns:
        the corresponding media type, or null if none found
      • getMediaTypes

        public static List<MediaTypegetMediaTypes​(@Nullable
                                                    String filename)
        Determine the media types for the given file name, if possible.
        Parameters:
        filename - the file name plus extension
        Returns:
        the corresponding media types, or an empty list if none found