public class DefaultMediaTypePredictor extends Object implements MediaTypePredictor
MediaTypePredictor that uses
DefaultMediaTypePredictor.CommonMediaTypes.| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultMediaTypePredictor.CommonMediaTypes
This enum represents file extension and MIME types of commonly used file.
|
| Constructor and Description |
|---|
DefaultMediaTypePredictor() |
| Modifier and Type | Method and Description |
|---|---|
static DefaultMediaTypePredictor |
getInstance()
Gets the singleton instance of this class.
|
javax.ws.rs.core.MediaType |
getMediaTypeFromFile(File file)
Get the media type from a file name.
|
javax.ws.rs.core.MediaType |
getMediaTypeFromFileName(String fileName)
Get the media type from a file name.
|
public javax.ws.rs.core.MediaType getMediaTypeFromFile(File file)
MediaTypePredictorgetMediaTypeFromFile in interface MediaTypePredictorfile - the file from which to get the MediaType.MediaType for the give file; null - if file
is null; "application/octet-stream" if extension not recognized.DefaultMediaTypePredictor.CommonMediaTypes.getMediaTypeFromFileName(java.lang.String)public javax.ws.rs.core.MediaType getMediaTypeFromFileName(String fileName)
MediaTypePredictorMediaType for
"*\/*", it will also return the same if the file is null.getMediaTypeFromFileName in interface MediaTypePredictorfileName - the file name from which to get the MediaType.MediaType for the give file; null - if file
is null; "application/octet-stream" if extension not recognized.public static DefaultMediaTypePredictor getInstance()
Copyright © 2007-2021, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.