OPENSOURCE

ALFRESCO CUSTOM MIMETYPES EXTENSION


Spring Datafication 2023. 4. 19. 22:07

ALFRESCO CUSTOM MIMETYPES EXTENSION

In previous alfresco mimetypes extensions custom mimetypes are defined by adding xml file.
In this case, lets consider a custom extension for hwp mimetype.
at

alfresco/extension/mimetype/mimetypes-extension-map.xml

<alfresco-config area="mimetype-map">
   <config evaluator="string-compare" condition="Mimetype Map">
      <mimetypes>
         <mimetype mimetype="application/x-hwp" display="X-HWP-HWP">
            <extension>hwp</extension>
         </mimetype>
      </mimetypes>
   </config>
</alfresco-config>

This definition copied into the shared directory of the docker instance gives an error of the following type:

COPY custom-mimetypes-extension-map.xml $TOMCAT_DIR/shared/classes/alfresco/extension/mimetypes/custom-mimetypes-extension-map.xml

JSON parse error: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null');
at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2418)

CAUSE OF ERROR

This is because the file is not in the correct format. The file must be in the format JSON.

SOLUTION

To solve this problem, we must convert the file into JSON format.

The file custom-mimetypes-extension-map.xml must be converted to custom-mimetypes-extension-map.json

Something like this:

{
   "mediaTypes": [
      {
         "name": "HWP MIME Type",
         "mediaType": "application/x-hwp",
         "extensions": [
            {"extension": "hwp", "default": true}
         ]
      }
   ]
}

If our custom-mimetypes-extension-map.json is defined correctly we can verify the newly added mimetype.
From the webscript endpoint http://:/alfresco/service/mimetypes .


Also we can verify the property of the newly added mimetype from the alfresco Share UI.

share ui mimetype verification
반응형

'OPENSOURCE' 카테고리의 다른 글

ALFRESCO TRANFORMATION ENGINE  (0) 2023.04.13