cancel
Showing results for 
Search instead for 
Did you mean: 

Transformer for application/octet-stream

alfrescot3ster
Champ in-the-making
Champ in-the-making
Hello guys!

I want to achieve my goal, transform a .msg (Outlook Email).
So I want to create a rendition for the mail body at least.

ContentTransformer transformer = contentService.getTransformer(actualMimetype, MimetypeMap.MIMETYPE_PDF);
if (transformer == null) {
    LOG.warn("no transformer found to transform from " + actualMimetype + " to application/pdf");
} else {
    render = renditionService.render(destNodeRef, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "pdf"));
}


The problem is, I can't transform a 'application/octet-stream' due to documentation:

<blockquote>"application/octet-stream and application/oda - bin, oda
These formats cannot be transformed into, or generated from, any other format."</blockquote>

Does anyone has a solution to create a rendition for a 'application/octet-stream' file ? Or can I change the file into a other mimetype?
2 REPLIES 2

steven_okennedy
Star Contributor
Star Contributor
Hi

application/octet-stream can be roughly considered as "a binary file that I don't understand" - this is basically used by Alfresco by default for files that it can't determine the mimetype of e.g. a file with an extension that it doesn't recognise.  As far as I know it uses the mimetype-map.xml file to hold a list of the default mime types and file extensions that it's aware of - this file lives in the alfresco-data-model.jar file these days.

However, there is already a mimetype mapping in the file that maps the .msg file extension to "application/vnd.ms-outlook", so I'm not sure why you're seeing application/octet-stream.  What exactly are you doing to create your rendition and what content are trying to transform?  Does your email have a .msg extension?

Regards

Steven

alfrescot3ster
Champ in-the-making
Champ in-the-making
Thx for the hint. The mimetype was sent from the frontend and it does not recognize the .msg mimetype Smiley Sad. Now it works quite good with 'application/vnd.ms-outlook'.

Now I have a other problem:


ContentWriter writer = contentService.getWriter(destNodeRef, ContentModel.PROP_CONTENT, true);
writer.setMimetype(mimetype);  // mimetype = 'application/vnd.ms-outlook'
writer.setEncoding("UTF-8");
writer.putContent(content);


But the encoding is still wrong, he can't decode 'ä', 'ü' and so on. Someone knows the solution?

Second thing, how can I get the attachments of an email? I used 'MailMetadataExtracter' to extract the metadatas, but I am not able to get the attachments. Someone knows that too?