Interface MediaTypePredictor

All Known Implementing Classes:
DefaultMediaTypePredictor

public interface MediaTypePredictor
An interface which allows developers implement their own media type predictor.
  • Method Summary

    Modifier and Type
    Method
    Description
    javax.ws.rs.core.MediaType
    Get the media type from a file name.
    javax.ws.rs.core.MediaType
    Get the media type from a file name.
  • Method Details

    • getMediaTypeFromFile

      javax.ws.rs.core.MediaType getMediaTypeFromFile(File file)
      Get the media type from a file name.
      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

      javax.ws.rs.core.MediaType getMediaTypeFromFileName(String fileName)
      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.
      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.