Class DefaultMediaTypePredictor
java.lang.Object
org.glassfish.jersey.media.multipart.file.DefaultMediaTypePredictor
- All Implemented Interfaces:
MediaTypePredictor
Default implementation of
MediaTypePredictor that uses
DefaultMediaTypePredictor.CommonMediaTypes.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThis enum represents file extension and MIME types of commonly used file. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DefaultMediaTypePredictorGets the singleton instance of this class.javax.ws.rs.core.MediaTypegetMediaTypeFromFile(File file) Get the media type from a file name.javax.ws.rs.core.MediaTypegetMediaTypeFromFileName(String fileName) Get the media type from a file name.
-
Field Details
-
MEDIA_TYPE_PREDICTOR
-
-
Constructor Details
-
DefaultMediaTypePredictor
public DefaultMediaTypePredictor()
-
-
Method Details
-
getMediaTypeFromFile
Description copied from interface:MediaTypePredictorGet the media type from a file name.- Specified by:
getMediaTypeFromFilein interfaceMediaTypePredictor- Parameters:
file- the file from which to get theMediaType.- Returns:
- the
MediaTypefor the give file;null- if file is null; "application/octet-stream" if extension not recognized. - See Also:
-
getMediaTypeFromFileName
Description copied from interface:MediaTypePredictorGet the media type from a file name. If the file name extension is not recognised it will returnMediaTypefor "*\/*", it will also return the same if the file isnull.- Specified by:
getMediaTypeFromFileNamein interfaceMediaTypePredictor- Parameters:
fileName- the file name from which to get theMediaType.- Returns:
- the
MediaTypefor the give file;null- if file is null; "application/octet-stream" if extension not recognized.
-
getInstance
Gets the singleton instance of this class.- Returns:
- the singleton instance.
-