public class MimeTypes extends Object
Constructor and Description |
---|
MimeTypes(NinjaProperties ninjaProperties) |
Modifier and Type | Method and Description |
---|---|
String |
getContentType(Context context,
String filename)
return the content-type from a file name.
|
String |
getContentType(Context context,
String filename,
String defaultContentType)
return the content-type from a file name.
For a text-based content-type, also return the encoding suffix eg. |
String |
getMimeType(String filename)
return the mimetype from a file name
|
String |
getMimeType(String filename,
String defaultMimeType)
return the mimetype from a file name.
|
boolean |
isValidMimeType(String mimeType)
check the mimetype is referenced in the mimetypes database
|
@Inject public MimeTypes(NinjaProperties ninjaProperties)
public String getMimeType(String filename)
filename
- the file namepublic String getMimeType(String filename, String defaultMimeType)
filename
- the file namedefaultMimeType
- the default mime type to return when no matching mimetype is
foundpublic String getContentType(Context context, String filename)
filename
- the file namepublic String getContentType(Context context, String filename, String defaultContentType)
filename
- the file namedefaultContentType
- the default content-type to return when no matching
content-type is foundpublic boolean isValidMimeType(String mimeType)
mimeType
- the mimeType to verifyCopyright © 2019 ninjaframework. All rights reserved.