Resolve Mimetype Related Issue Through Script in Alfresco

Alfreso is content management system and thus it support various different type of contents like word, pdf, images, odf, xls any list goes on. Now for any content management system when we talk about support for particular content type it is not just merely identifying type of content during upload and show related to icon on the User Interface. It actually takes lot more than that to support particular mimetype.

When you upload a particular content in alfresco it first check for related mimetype based on then extension of file from given mimetype map. You can see that mimetype map in alfresco installation under

<ALF_HOME>\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\mimetype\mimetype-map.xml

For Instance

    <mimetype mimetype="application/vnd.openxmlformats-officedocument.wordprocessingml.document" display="Microsoft Word 2007">

            <extension>docx</extension>

    </mimetype>

Here is one of the entry from that file and as per this entry when extension of file is “docx” it should associate “application/vnd.openxmlformats-officedocument.wordprocessingml.document” mimetype with that document during upload and on User Interface it should show “Microsoft Word 2007” as its mimetype because for normal user previous one does not make any sense.

Now if there is some type of file which is not supported in alfresco but we want to include support for that I have explained in my previous post Add custom mime-type in alfresco about how to achieve that.

Now once particular mimetype is associated with document there is related metadata extractors for that mimetype which is being invoked to extract common meta-data from that content. To get more details on meta-data extraction you can refer my previous posts.

Then there transformers related to that mimetype which will create one text file by extracting all content from that document and that is used for indexing document content.

Many times we encounter issue related to mimetype in alfresco especially when we create contents in alfresco through backend like webscript  or javascript . If we fail to associate mimetype with uploaded document it throws error on user interface (like following image), when you tried to view that document details.

To resolve that error create one simple script which an add mimetype on those related content. Even if that is not exactly matching with give actual content type it will stop error being thrown on User Interface.

Here is the script which you can use.

Now one you have that script you an associate it with rule which will be invoked during content upload and execute script on incoming document.

Hope this gives you some understanding on importance of mimetype and help you to resolve issue related to mimetype.

Looking for quality Alfresco Web Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , | Posted under Alfresco | RSS 2.0

Author Spotlight

mitpatoliya

I love opensource technologies working with those technologies from the time I have stepped in to the Software Industry. Alfresco CMS is my area of expertise. I have worked on various complex implementations which involved integration of Alfresco with other technologies, extensively worked with JBPM workflows and Webscripts.

Leave a Reply

Your email address will not be published. Required fields are marked *