Package org.alfresco.repo.content
Class MimetypeMap
- java.lang.Object
-
- org.alfresco.repo.content.MimetypeMap
-
- All Implemented Interfaces:
MimetypeService
public class MimetypeMap extends Object implements MimetypeService
Provides a bidirectional mapping between well-known mimetypes and the registered file extensions. All mimetypes and extensions are stored and handled as lowercase.- Author:
- Derek Hulley
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description MimetypeMap()
Default constructorMimetypeMap(org.springframework.extensions.config.ConfigService configService)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.alfresco.repo.content.MimetypeMap.Data
createData()
org.springframework.extensions.config.ConfigService
getConfigService()
ContentCharsetFinder
getContentCharsetFinder()
Provides the system default charset finder.org.alfresco.repo.content.MimetypeMap.Data
getData()
Map<String,String>
getDisplaysByExtension()
Get all human readable mimetype descriptions indexed by mimetype extensionMap<String,String>
getDisplaysByMimetype()
Get all human readable mimetype descriptions indexed by mimetypeString
getExtension(String mimetype)
Get the file extension associated with the mimetype.Map<String,String>
getExtensionsByMimetype()
Get all mimetype extensions indexed by mimetypeString
getMimetype(String extension)
Get the mimetype for the specified extensionString
getMimetypeIfNotMatches(ContentReader reader)
Use Apache Tika to check if the mime type of the document really matches what it claims to be.List<String>
getMimetypes()
Get all mimetypesCollection<String>
getMimetypes(String extension)
Returns a collection of mimetypes ordered by extension.Map<String,String>
getMimetypesByExtension()
Get all mimetypes indexed by extensionString
guessMimetype(String filename)
Takes a guess at the mimetype based exclusively on the file extension, which can (and often is) wrong...String
guessMimetype(String filename, InputStream input)
Uses Tika to try to identify the mimetype of the file, falling back onguessMimetype(String)
for an extension based one if Tika can't help.String
guessMimetype(String filename, ContentReader reader)
Uses Tika to try to identify the mimetype of the file, falling back onguessMimetype(String)
for an extension based one if Tika can't help.void
init()
Initialises the map using the configuration service providedboolean
isText(String mimetype)
Check if a given mimetype represents a text format.boolean
readConfig()
void
setConfigService(org.springframework.extensions.config.ConfigService configService)
void
setContentCharsetFinder(ContentCharsetFinder contentCharsetFinder)
Set the system default content characterset decodervoid
setCronExpression(org.quartz.CronExpression cronExpression)
void
setInitialAndOnErrorCronExpression(org.quartz.CronExpression initialAndOnErrorCronExpression)
void
setJsonObjectMapper(com.fasterxml.jackson.databind.ObjectMapper jsonObjectMapper)
void
setMimetypeJsonConfigDir(String mimetypeJsonConfigDir)
void
setShutdownIndicator(ShutdownIndicator shutdownIndicator)
void
setTikaConfig(org.apache.tika.config.TikaConfig tikaConfig)
Injects the TikaConfig to use
-
-
-
Field Detail
-
PREFIX_APPLICATION
public static final String PREFIX_APPLICATION
- See Also:
- Constant Field Values
-
PREFIX_AUDIO
public static final String PREFIX_AUDIO
- See Also:
- Constant Field Values
-
PREFIX_IMAGE
public static final String PREFIX_IMAGE
- See Also:
- Constant Field Values
-
PREFIX_MESSAGE
public static final String PREFIX_MESSAGE
- See Also:
- Constant Field Values
-
PREFIX_MODEL
public static final String PREFIX_MODEL
- See Also:
- Constant Field Values
-
PREFIX_MULTIPART
public static final String PREFIX_MULTIPART
- See Also:
- Constant Field Values
-
PREFIX_TEXT
public static final String PREFIX_TEXT
- See Also:
- Constant Field Values
-
PREFIX_VIDEO
public static final String PREFIX_VIDEO
- See Also:
- Constant Field Values
-
EXTENSION_BINARY
public static final String EXTENSION_BINARY
- See Also:
- Constant Field Values
-
MACOS_RESOURCE_FORK_FILE_NAME_PREFIX
public static final String MACOS_RESOURCE_FORK_FILE_NAME_PREFIX
- See Also:
- Constant Field Values
-
MIMETYPE_MULTIPART_ALTERNATIVE
public static final String MIMETYPE_MULTIPART_ALTERNATIVE
- See Also:
- Constant Field Values
-
MIMETYPE_TEXT_PLAIN
public static final String MIMETYPE_TEXT_PLAIN
- See Also:
- Constant Field Values
-
MIMETYPE_TEXT_MEDIAWIKI
public static final String MIMETYPE_TEXT_MEDIAWIKI
- See Also:
- Constant Field Values
-
MIMETYPE_TEXT_CSS
public static final String MIMETYPE_TEXT_CSS
- See Also:
- Constant Field Values
-
MIMETYPE_TEXT_CSV
public static final String MIMETYPE_TEXT_CSV
- See Also:
- Constant Field Values
-
MIMETYPE_TEXT_JAVASCRIPT
public static final String MIMETYPE_TEXT_JAVASCRIPT
- See Also:
- Constant Field Values
-
MIMETYPE_XML
public static final String MIMETYPE_XML
- See Also:
- Constant Field Values
-
MIMETYPE_HTML
public static final String MIMETYPE_HTML
- See Also:
- Constant Field Values
-
MIMETYPE_XHTML
public static final String MIMETYPE_XHTML
- See Also:
- Constant Field Values
-
MIMETYPE_PDF
public static final String MIMETYPE_PDF
- See Also:
- Constant Field Values
-
MIMETYPE_JSON
public static final String MIMETYPE_JSON
- See Also:
- Constant Field Values
-
MIMETYPE_WORD
public static final String MIMETYPE_WORD
- See Also:
- Constant Field Values
-
MIMETYPE_EXCEL
public static final String MIMETYPE_EXCEL
- See Also:
- Constant Field Values
-
MIMETYPE_BINARY
public static final String MIMETYPE_BINARY
- See Also:
- Constant Field Values
-
MIMETYPE_PPT
public static final String MIMETYPE_PPT
- See Also:
- Constant Field Values
-
MIMETYPE_APP_DWG
public static final String MIMETYPE_APP_DWG
- See Also:
- Constant Field Values
-
MIMETYPE_IMG_DWG
public static final String MIMETYPE_IMG_DWG
- See Also:
- Constant Field Values
-
MIMETYPE_VIDEO_AVI
public static final String MIMETYPE_VIDEO_AVI
- See Also:
- Constant Field Values
-
MIMETYPE_VIDEO_QUICKTIME
public static final String MIMETYPE_VIDEO_QUICKTIME
- See Also:
- Constant Field Values
-
MIMETYPE_VIDEO_WMV
public static final String MIMETYPE_VIDEO_WMV
- See Also:
- Constant Field Values
-
MIMETYPE_VIDEO_3GP
public static final String MIMETYPE_VIDEO_3GP
- See Also:
- Constant Field Values
-
MIMETYPE_VIDEO_3GP2
public static final String MIMETYPE_VIDEO_3GP2
- See Also:
- Constant Field Values
-
MIMETYPE_DITA
public static final String MIMETYPE_DITA
- See Also:
- Constant Field Values
-
MIMETYPE_FLASH
public static final String MIMETYPE_FLASH
- See Also:
- Constant Field Values
-
MIMETYPE_VIDEO_FLV
public static final String MIMETYPE_VIDEO_FLV
- See Also:
- Constant Field Values
-
MIMETYPE_APPLICATION_FLA
public static final String MIMETYPE_APPLICATION_FLA
- See Also:
- Constant Field Values
-
MIMETYPE_VIDEO_MPG
public static final String MIMETYPE_VIDEO_MPG
- See Also:
- Constant Field Values
-
MIMETYPE_VIDEO_MP4
public static final String MIMETYPE_VIDEO_MP4
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_GIF
public static final String MIMETYPE_IMAGE_GIF
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_JPEG
public static final String MIMETYPE_IMAGE_JPEG
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_RGB
public static final String MIMETYPE_IMAGE_RGB
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_SVG
public static final String MIMETYPE_IMAGE_SVG
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_PNG
public static final String MIMETYPE_IMAGE_PNG
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_TIFF
public static final String MIMETYPE_IMAGE_TIFF
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_RAW_DNG
public static final String MIMETYPE_IMAGE_RAW_DNG
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_RAW_3FR
public static final String MIMETYPE_IMAGE_RAW_3FR
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_RAW_RAF
public static final String MIMETYPE_IMAGE_RAW_RAF
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_RAW_CR2
public static final String MIMETYPE_IMAGE_RAW_CR2
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_RAW_K25
public static final String MIMETYPE_IMAGE_RAW_K25
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_RAW_MRW
public static final String MIMETYPE_IMAGE_RAW_MRW
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_RAW_NEF
public static final String MIMETYPE_IMAGE_RAW_NEF
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_RAW_ORF
public static final String MIMETYPE_IMAGE_RAW_ORF
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_RAW_PEF
public static final String MIMETYPE_IMAGE_RAW_PEF
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_RAW_ARW
public static final String MIMETYPE_IMAGE_RAW_ARW
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_RAW_X3F
public static final String MIMETYPE_IMAGE_RAW_X3F
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_RAW_RW2
public static final String MIMETYPE_IMAGE_RAW_RW2
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_RAW_RWL
public static final String MIMETYPE_IMAGE_RAW_RWL
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_RAW_R3D
public static final String MIMETYPE_IMAGE_RAW_R3D
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_DWT
public static final String MIMETYPE_IMAGE_DWT
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_ICNS
public static final String MIMETYPE_IMAGE_ICNS
- See Also:
- Constant Field Values
-
MIMETYPE_APPLICATION_EPS
public static final String MIMETYPE_APPLICATION_EPS
- See Also:
- Constant Field Values
-
MIMETYPE_APPLICATION_PS
public static final String MIMETYPE_APPLICATION_PS
- See Also:
- Constant Field Values
-
MIMETYPE_JAVASCRIPT
public static final String MIMETYPE_JAVASCRIPT
- See Also:
- Constant Field Values
-
MIMETYPE_ZIP
public static final String MIMETYPE_ZIP
- See Also:
- Constant Field Values
-
MIMETYPE_OPENSEARCH_DESCRIPTION
public static final String MIMETYPE_OPENSEARCH_DESCRIPTION
- See Also:
- Constant Field Values
-
MIMETYPE_ATOM
public static final String MIMETYPE_ATOM
- See Also:
- Constant Field Values
-
MIMETYPE_RSS
public static final String MIMETYPE_RSS
- See Also:
- Constant Field Values
-
MIMETYPE_RFC822
public static final String MIMETYPE_RFC822
- See Also:
- Constant Field Values
-
MIMETYPE_OUTLOOK_MSG
public static final String MIMETYPE_OUTLOOK_MSG
- See Also:
- Constant Field Values
-
MIMETYPE_VISIO
public static final String MIMETYPE_VISIO
- See Also:
- Constant Field Values
-
MIMETYPE_VISIO_2013
public static final String MIMETYPE_VISIO_2013
- See Also:
- Constant Field Values
-
MIMETYPE_APPLICATION_ILLUSTRATOR
public static final String MIMETYPE_APPLICATION_ILLUSTRATOR
- See Also:
- Constant Field Values
-
MIMETYPE_APPLICATION_PHOTOSHOP
public static final String MIMETYPE_APPLICATION_PHOTOSHOP
- See Also:
- Constant Field Values
-
MIMETYPE_ENCRYPTED_OFFICE
public static final String MIMETYPE_ENCRYPTED_OFFICE
- See Also:
- Constant Field Values
-
MIMETYPE_OPENDOCUMENT_TEXT
public static final String MIMETYPE_OPENDOCUMENT_TEXT
- See Also:
- Constant Field Values
-
MIMETYPE_OPENDOCUMENT_TEXT_TEMPLATE
public static final String MIMETYPE_OPENDOCUMENT_TEXT_TEMPLATE
- See Also:
- Constant Field Values
-
MIMETYPE_OPENDOCUMENT_GRAPHICS
public static final String MIMETYPE_OPENDOCUMENT_GRAPHICS
- See Also:
- Constant Field Values
-
MIMETYPE_OPENDOCUMENT_GRAPHICS_TEMPLATE
public static final String MIMETYPE_OPENDOCUMENT_GRAPHICS_TEMPLATE
- See Also:
- Constant Field Values
-
MIMETYPE_OPENDOCUMENT_PRESENTATION
public static final String MIMETYPE_OPENDOCUMENT_PRESENTATION
- See Also:
- Constant Field Values
-
MIMETYPE_OPENDOCUMENT_PRESENTATION_TEMPLATE
public static final String MIMETYPE_OPENDOCUMENT_PRESENTATION_TEMPLATE
- See Also:
- Constant Field Values
-
MIMETYPE_OPENDOCUMENT_SPREADSHEET
public static final String MIMETYPE_OPENDOCUMENT_SPREADSHEET
- See Also:
- Constant Field Values
-
MIMETYPE_OPENDOCUMENT_SPREADSHEET_TEMPLATE
public static final String MIMETYPE_OPENDOCUMENT_SPREADSHEET_TEMPLATE
- See Also:
- Constant Field Values
-
MIMETYPE_OPENDOCUMENT_CHART
public static final String MIMETYPE_OPENDOCUMENT_CHART
- See Also:
- Constant Field Values
-
MIMETYPE_OPENDOCUMENT_CHART_TEMPLATE
public static final String MIMETYPE_OPENDOCUMENT_CHART_TEMPLATE
- See Also:
- Constant Field Values
-
MIMETYPE_OPENDOCUMENT_IMAGE
public static final String MIMETYPE_OPENDOCUMENT_IMAGE
- See Also:
- Constant Field Values
-
MIMETYPE_OPENDOCUMENT_IMAGE_TEMPLATE
public static final String MIMETYPE_OPENDOCUMENT_IMAGE_TEMPLATE
- See Also:
- Constant Field Values
-
MIMETYPE_OPENDOCUMENT_FORMULA
public static final String MIMETYPE_OPENDOCUMENT_FORMULA
- See Also:
- Constant Field Values
-
MIMETYPE_OPENDOCUMENT_FORMULA_TEMPLATE
public static final String MIMETYPE_OPENDOCUMENT_FORMULA_TEMPLATE
- See Also:
- Constant Field Values
-
MIMETYPE_OPENDOCUMENT_TEXT_MASTER
public static final String MIMETYPE_OPENDOCUMENT_TEXT_MASTER
- See Also:
- Constant Field Values
-
MIMETYPE_OPENDOCUMENT_TEXT_WEB
public static final String MIMETYPE_OPENDOCUMENT_TEXT_WEB
- See Also:
- Constant Field Values
-
MIMETYPE_OPENDOCUMENT_DATABASE
public static final String MIMETYPE_OPENDOCUMENT_DATABASE
- See Also:
- Constant Field Values
-
MIMETYPE_OPENOFFICE1_WRITER
public static final String MIMETYPE_OPENOFFICE1_WRITER
- See Also:
- Constant Field Values
-
MIMETYPE_OPENOFFICE1_CALC
public static final String MIMETYPE_OPENOFFICE1_CALC
- See Also:
- Constant Field Values
-
MIMETYPE_OPENOFFICE1_DRAW
public static final String MIMETYPE_OPENOFFICE1_DRAW
- See Also:
- Constant Field Values
-
MIMETYPE_OPENOFFICE1_IMPRESS
public static final String MIMETYPE_OPENOFFICE1_IMPRESS
- See Also:
- Constant Field Values
-
MIMETYPE_OPENXML_WORDPROCESSING
public static final String MIMETYPE_OPENXML_WORDPROCESSING
- See Also:
- Constant Field Values
-
MIMETYPE_OPENXML_WORDPROCESSING_MACRO
public static final String MIMETYPE_OPENXML_WORDPROCESSING_MACRO
- See Also:
- Constant Field Values
-
MIMETYPE_OPENXML_WORD_TEMPLATE
public static final String MIMETYPE_OPENXML_WORD_TEMPLATE
- See Also:
- Constant Field Values
-
MIMETYPE_OPENXML_WORD_TEMPLATE_MACRO
public static final String MIMETYPE_OPENXML_WORD_TEMPLATE_MACRO
- See Also:
- Constant Field Values
-
MIMETYPE_OPENXML_SPREADSHEET
public static final String MIMETYPE_OPENXML_SPREADSHEET
- See Also:
- Constant Field Values
-
MIMETYPE_OPENXML_SPREADSHEET_TEMPLATE
public static final String MIMETYPE_OPENXML_SPREADSHEET_TEMPLATE
- See Also:
- Constant Field Values
-
MIMETYPE_OPENXML_SPREADSHEET_MACRO
public static final String MIMETYPE_OPENXML_SPREADSHEET_MACRO
- See Also:
- Constant Field Values
-
MIMETYPE_OPENXML_SPREADSHEET_TEMPLATE_MACRO
public static final String MIMETYPE_OPENXML_SPREADSHEET_TEMPLATE_MACRO
- See Also:
- Constant Field Values
-
MIMETYPE_OPENXML_SPREADSHEET_ADDIN_MACRO
public static final String MIMETYPE_OPENXML_SPREADSHEET_ADDIN_MACRO
- See Also:
- Constant Field Values
-
MIMETYPE_OPENXML_SPREADSHEET_BINARY_MACRO
public static final String MIMETYPE_OPENXML_SPREADSHEET_BINARY_MACRO
- See Also:
- Constant Field Values
-
MIMETYPE_OPENXML_PRESENTATION
public static final String MIMETYPE_OPENXML_PRESENTATION
- See Also:
- Constant Field Values
-
MIMETYPE_OPENXML_PRESENTATION_MACRO
public static final String MIMETYPE_OPENXML_PRESENTATION_MACRO
- See Also:
- Constant Field Values
-
MIMETYPE_OPENXML_PRESENTATION_SLIDESHOW
public static final String MIMETYPE_OPENXML_PRESENTATION_SLIDESHOW
- See Also:
- Constant Field Values
-
MIMETYPE_OPENXML_PRESENTATION_SLIDESHOW_MACRO
public static final String MIMETYPE_OPENXML_PRESENTATION_SLIDESHOW_MACRO
- See Also:
- Constant Field Values
-
MIMETYPE_OPENXML_PRESENTATION_TEMPLATE
public static final String MIMETYPE_OPENXML_PRESENTATION_TEMPLATE
- See Also:
- Constant Field Values
-
MIMETYPE_OPENXML_PRESENTATION_TEMPLATE_MACRO
public static final String MIMETYPE_OPENXML_PRESENTATION_TEMPLATE_MACRO
- See Also:
- Constant Field Values
-
MIMETYPE_OPENXML_PRESENTATION_ADDIN
public static final String MIMETYPE_OPENXML_PRESENTATION_ADDIN
- See Also:
- Constant Field Values
-
MIMETYPE_OPENXML_PRESENTATION_SLIDE
public static final String MIMETYPE_OPENXML_PRESENTATION_SLIDE
- See Also:
- Constant Field Values
-
MIMETYPE_OPENXML_PRESENTATION_SLIDE_MACRO
public static final String MIMETYPE_OPENXML_PRESENTATION_SLIDE_MACRO
- See Also:
- Constant Field Values
-
MIMETYPE_STAROFFICE5_DRAW
public static final String MIMETYPE_STAROFFICE5_DRAW
- See Also:
- Constant Field Values
-
MIMETYPE_STAROFFICE5_CALC
public static final String MIMETYPE_STAROFFICE5_CALC
- See Also:
- Constant Field Values
-
MIMETYPE_STAROFFICE5_IMPRESS
public static final String MIMETYPE_STAROFFICE5_IMPRESS
- See Also:
- Constant Field Values
-
MIMETYPE_STAROFFICE5_IMPRESS_PACKED
public static final String MIMETYPE_STAROFFICE5_IMPRESS_PACKED
- See Also:
- Constant Field Values
-
MIMETYPE_STAROFFICE5_CHART
public static final String MIMETYPE_STAROFFICE5_CHART
- See Also:
- Constant Field Values
-
MIMETYPE_STAROFFICE5_WRITER
public static final String MIMETYPE_STAROFFICE5_WRITER
- See Also:
- Constant Field Values
-
MIMETYPE_STAROFFICE5_WRITER_GLOBAL
public static final String MIMETYPE_STAROFFICE5_WRITER_GLOBAL
- See Also:
- Constant Field Values
-
MIMETYPE_STAROFFICE5_MATH
public static final String MIMETYPE_STAROFFICE5_MATH
- See Also:
- Constant Field Values
-
MIMETYPE_IWORK_KEYNOTE
public static final String MIMETYPE_IWORK_KEYNOTE
- See Also:
- Constant Field Values
-
MIMETYPE_IWORK_NUMBERS
public static final String MIMETYPE_IWORK_NUMBERS
- See Also:
- Constant Field Values
-
MIMETYPE_IWORK_PAGES
public static final String MIMETYPE_IWORK_PAGES
- See Also:
- Constant Field Values
-
MIMETYPE_APPLEFILE
public static final String MIMETYPE_APPLEFILE
- See Also:
- Constant Field Values
-
MIMETYPE_WORDPERFECT
public static final String MIMETYPE_WORDPERFECT
- See Also:
- Constant Field Values
-
MIMETYPE_MP3
public static final String MIMETYPE_MP3
- See Also:
- Constant Field Values
-
MIMETYPE_AUDIO_MP4
public static final String MIMETYPE_AUDIO_MP4
- See Also:
- Constant Field Values
-
MIMETYPE_VORBIS
public static final String MIMETYPE_VORBIS
- See Also:
- Constant Field Values
-
MIMETYPE_FLAC
public static final String MIMETYPE_FLAC
- See Also:
- Constant Field Values
-
MIMETYPE_ACP
public static final String MIMETYPE_ACP
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MimetypeMap
public MimetypeMap()
Default constructor- Since:
- 2.1
-
MimetypeMap
@Deprecated public MimetypeMap(org.springframework.extensions.config.ConfigService configService)
Deprecated.
-
-
Method Detail
-
createData
public org.alfresco.repo.content.MimetypeMap.Data createData()
-
getData
public org.alfresco.repo.content.MimetypeMap.Data getData()
-
getConfigService
public org.springframework.extensions.config.ConfigService getConfigService()
-
setConfigService
public void setConfigService(org.springframework.extensions.config.ConfigService configService)
- Parameters:
configService
- the config service to use to read mimetypes from
-
getContentCharsetFinder
public ContentCharsetFinder getContentCharsetFinder()
Provides the system default charset finder.- Specified by:
getContentCharsetFinder
in interfaceMimetypeService
- Returns:
- Returns a character set finder that can be used to decode streams in order to get the encoding.
-
setContentCharsetFinder
public void setContentCharsetFinder(ContentCharsetFinder contentCharsetFinder)
Set the system default content characterset decoder
-
setTikaConfig
public void setTikaConfig(org.apache.tika.config.TikaConfig tikaConfig)
Injects the TikaConfig to use- Parameters:
tikaConfig
- The Tika Config to use
-
setJsonObjectMapper
public void setJsonObjectMapper(com.fasterxml.jackson.databind.ObjectMapper jsonObjectMapper)
-
setMimetypeJsonConfigDir
public void setMimetypeJsonConfigDir(String mimetypeJsonConfigDir)
-
setCronExpression
public void setCronExpression(org.quartz.CronExpression cronExpression)
-
setInitialAndOnErrorCronExpression
public void setInitialAndOnErrorCronExpression(org.quartz.CronExpression initialAndOnErrorCronExpression)
-
setShutdownIndicator
public void setShutdownIndicator(ShutdownIndicator shutdownIndicator)
-
init
public void init()
Initialises the map using the configuration service provided
-
readConfig
public boolean readConfig()
-
getExtension
public String getExtension(String mimetype)
Get the file extension associated with the mimetype.- Specified by:
getExtension
in interfaceMimetypeService
- Parameters:
mimetype
- a valid mimetype- Returns:
- Returns the default extension for the mimetype. Returns the
binary
mimetype extension. - See Also:
MIMETYPE_BINARY
,EXTENSION_BINARY
-
getMimetype
public String getMimetype(String extension)
Get the mimetype for the specified extension- Specified by:
getMimetype
in interfaceMimetypeService
- Parameters:
extension
- a valid file extension- Returns:
- Returns a valid mimetype if found, or
binary
as default.
-
getDisplaysByExtension
public Map<String,String> getDisplaysByExtension()
Description copied from interface:MimetypeService
Get all human readable mimetype descriptions indexed by mimetype extension- Specified by:
getDisplaysByExtension
in interfaceMimetypeService
- Returns:
- the map of displays indexed by extension
-
getDisplaysByMimetype
public Map<String,String> getDisplaysByMimetype()
Description copied from interface:MimetypeService
Get all human readable mimetype descriptions indexed by mimetype- Specified by:
getDisplaysByMimetype
in interfaceMimetypeService
- Returns:
- the map of displays indexed by mimetype
-
getExtensionsByMimetype
public Map<String,String> getExtensionsByMimetype()
Description copied from interface:MimetypeService
Get all mimetype extensions indexed by mimetype- Specified by:
getExtensionsByMimetype
in interfaceMimetypeService
- Returns:
- the map of extension indexed by mimetype
-
getMimetypes
public List<String> getMimetypes()
Description copied from interface:MimetypeService
Get all mimetypes- Specified by:
getMimetypes
in interfaceMimetypeService
- Returns:
- all mimetypes
-
getMimetypesByExtension
public Map<String,String> getMimetypesByExtension()
Description copied from interface:MimetypeService
Get all mimetypes indexed by extension- Specified by:
getMimetypesByExtension
in interfaceMimetypeService
- Returns:
- the map of mimetypes indexed by extension
-
isText
public boolean isText(String mimetype)
Description copied from interface:MimetypeService
Check if a given mimetype represents a text format.- Specified by:
isText
in interfaceMimetypeService
- Parameters:
mimetype
- the mimetype to check- Returns:
- Returns true if it is text
-
getMimetypeIfNotMatches
public String getMimetypeIfNotMatches(ContentReader reader)
Use Apache Tika to check if the mime type of the document really matches what it claims to be. This is typically used when a transformation or metadata extractions fails, and you want to know if someone has renamed a file and consequently it has the wrong mime type.- Specified by:
getMimetypeIfNotMatches
in interfaceMimetypeService
- Returns:
- Null if the mime type seems ok, otherwise the mime type it probably is
-
guessMimetype
public String guessMimetype(String filename)
Takes a guess at the mimetype based exclusively on the file extension, which can (and often is) wrong...- Specified by:
guessMimetype
in interfaceMimetypeService
- Parameters:
filename
- the name of the file with an optional file extension- Returns:
- Returns the best guess mimetype or the mimetype for straight binary files if no extension could be found.
- See Also:
MIMETYPE_BINARY
-
guessMimetype
public String guessMimetype(String filename, ContentReader reader)
Uses Tika to try to identify the mimetype of the file, falling back onguessMimetype(String)
for an extension based one if Tika can't help.- Specified by:
guessMimetype
in interfaceMimetypeService
- Parameters:
filename
- the name of the file with an optional file extensionreader
- a reader for the content of the file- Returns:
- Returns the best guess mimetype or the mimetype for straight binary files if no extension could be found.
-
guessMimetype
public String guessMimetype(String filename, InputStream input)
Uses Tika to try to identify the mimetype of the file, falling back onguessMimetype(String)
for an extension based one if Tika can't help.- Specified by:
guessMimetype
in interfaceMimetypeService
- Parameters:
filename
- the name of the file with an optional file extensioninput
- an input stream for the content- Returns:
- Returns the best guess mimetype or the mimetype for straight binary files if no extension could be found.
-
getMimetypes
public Collection<String> getMimetypes(String extension)
Returns a collection of mimetypes ordered by extension.- Specified by:
getMimetypes
in interfaceMimetypeService
- Parameters:
extension
- to restrict the collection to one entry
-
-