Class DefaultMediaTypePredictor

java.lang.Object
org.glassfish.jersey.media.multipart.file.DefaultMediaTypePredictor
All Implemented Interfaces:
MediaTypePredictor

public class DefaultMediaTypePredictor extends Object implements MediaTypePredictor
  • Field Details

  • Constructor Details

    • DefaultMediaTypePredictor

      public DefaultMediaTypePredictor()
  • Method Details

    • getMediaTypeFromFile

      public javax.ws.rs.core.MediaType getMediaTypeFromFile(File file)
      Description copied from interface: MediaTypePredictor
      Get the media type from a file name.
      Specified by:
      getMediaTypeFromFile in interface MediaTypePredictor
      Parameters:
      file - the file from which to get the MediaType.
      Returns:
      the MediaType for the give file; null - if file is null; "application/octet-stream" if extension not recognized.
      See Also:
    • getMediaTypeFromFileName

      public javax.ws.rs.core.MediaType getMediaTypeFromFileName(String fileName)
      Description copied from interface: MediaTypePredictor
      Get the media type from a file name. If the file name extension is not recognised it will return MediaType for "*\/*", it will also return the same if the file is null.
      Specified by:
      getMediaTypeFromFileName in interface MediaTypePredictor
      Parameters:
      fileName - the file name from which to get the MediaType.
      Returns:
      the MediaType for the give file; null - if file is null; "application/octet-stream" if extension not recognized.
    • getInstance

      public static DefaultMediaTypePredictor getInstance()
      Gets the singleton instance of this class.
      Returns:
      the singleton instance.