cancel
Showing results for 
Search instead for 
Did you mean: 

Add new mimetype via AMP

abruzzi
Champ on-the-rise
Champ on-the-rise
I'm working on a amp to do some content transformations using an external server, and I need to define a new mimetype.  According to this page:

https://wiki.alfresco.com/wiki/Adding_a_Mime_Type

The content needs to go into this file:

/META-INF/mimetype/mimetype-map-custom.xml

So I created a maven project with a custom file-mapping.properties (since META-INF doesn't seem to be part of the standard amp file mapping)  And I created a file in the above location with the following content:



<alfresco-config area="mimetype-map">
    <config evaluator="string-compare" condition="Mimetype Map">
        <mimetypes>
            <mimetype mimetype="application/vnd.dac-ocr-pdf" display="MIMEtype for OCR'ed PDF for use in OCR-in-place">
                <extension>dacocr</extension>
            </mimetype>
        </mimetypes>
    </config>
</alfresco-config>


(this is a fake mimetype I'm using to do pdf to pdf conversion using an OCR server)

After running the build and test, I go to:

http://localhost:8080/alfresco/service/mimetypes

to see if the new mimetype is registered, and I see nothing.  I have double checked the war file in the maven target directory and it seems to be putting the file in the right spot.  I see no errors in the logs.  Am I missing something?

Also, is it possible to rename the file?  If the name has to be mimetype-map-custom.xml, there are potential conflicts if another amp want to add a mimetype as well.

I'm currently building against 4.2.1 enterprise.

thanks,

Geof
2 REPLIES 2

abruzzi
Champ on-the-rise
Champ on-the-rise
So I got it working by randomly trying location in the war.  The working location is:

WEB-INF/classes/alfresco/extension/mimetype/abbyy-mimetype-map.xml

So, before I move on, is this a reasonable location, or is there somewhere else that is better suited?

Geof

kaynezhang
World-Class Innovator
World-Class Innovator
You can place your mimetype-map-custom.xml file under
/config/alfresco/module/yourmoduleid/
in your amp file,when deployed ,it will copy to
 classpath*:alfresco/module/*/

Or also just like you do place it under
classpath*:alfresco/extension/mimetype
and name it like *-map.xml,but you'd better place it under extension class path instead of
 WEB-INF/classes/