creating custom MIME type in cq5/AEM - mime-types

I need to add support for a proprietary 3D format in cq5/AEM. Despite having absolutely no experience with this, I managed to generate a few working components to visualize the assets.
But now, I need to create custom media handler to generate renditions and thumbnails from the model. The problem is, media handlers can only work on assets of specific MIME types, and cq5 do not associate a type to my assets. Thus, I can not have a media handler called on them.
Is there any way to customize how cq5 associate MIME types to an asset, or I is there another way to circumvent the problem?

Ok, I found what I needed. You can link MIME type to extensions by going to the OSGI console at http://localhost:4502/system/console/configMgr and to the Apache Sling MIME type Service configuration. There, you can add new MIME / extension link:
MIME extensions...
model/collada+xml dae

Related

CefSharp fails to download css due to mime type mismatch

I'm trying to implement CesSharp for browser support inside of a Winform/WPF application and running into an issue getting the styles to apply on the page. I'm able to embed the browser into the page, but the styles are completely missing. When I check the log file, I see that they were blocked due to a strict MIME checking, but am unsure where I should go to intercept that check.
"Refused to apply style from 'https://example.com/styles/ig_panel.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.", source: https://example.com/myPage.aspx (0)
If I browse to myPage in the example, above I see that the type is showing as css not html, so I'm not sure where the incorrect MIME type is coming from. Is this something that can be addressed from the CefSharp RequestHandler or does it require changes on the server?
UPDATE: It appears that the css request in question when accessed through CefSharp is getting a http 405 causing the mime type to come out as text/html instead of text/css. Now to determine what's causing the 405.

Visual Studio: adding image as resource vs. simply adding the file

What is the difference between adding an existing image (.png) as a resource and simply adding the file to the solution? Which is to be preferred, in general and especially as a button content?
A build action of 'Resource' embeds the image in your assembly so that it doesn't need to be shipped as a loose file with your application. A build action of 'Content' adds the image to the manifest so the application knows about it and expects it to be present, but doesn't embed the image--you need to deploy the file separately, and the application will search for it at runtime. Both resources and content can be referenced with relative and absolute pack: URIs.
A build action of 'None' does nothing. If you include the file with your application, you won't be able to reference it with a pack: URI unless you use the absolute URI form with a siteoforigin:,,, authority. It's best not to do this, especially since the behavior changes when your application is deployed with ClickOnce.

Converting Blob object to html in google app

I have stored user uploaded document (.doc ,.pdf) as a Blob object into data-store.
Instead of allowing user to download the document, I would like to present it as an HTML page
for viewing the doc. how do I convert Blob into HTML ? does google app engine provides any ready made API for the same?
There is no ready made API in AppEngine to convert .doc or .pdf (or or other types of) files to HTML. You would need to find a library for your preferred language to parse the blob file into its parts structured as an object model (like a DOM). Then you would need to write code to convert individual parts of the object model to HTML, unless you are lucky enough to find another library. And no, StackOverflow is not a good place to ask "what library is there...".
No. AppEngine itself does not provide any file format conversion tools. You might want to look into Google Drive API, which might, to some extent, do the format conversion for you.
You can have embed a PDF reader on a web page by using pdf.js.
Most browsers already have a built-in PDF viewer. If you provide a link to a PDF file, when users click on it, many browsers will automatically display the document. Those browsers that do not support this option, will offer a user to download the file to their hard-drive.
This is the easiest solution - you don't have to do anything at all.

How to change attachment MIME type

I'm using XPages FileUpload control to save some attachments (.xml files) to the document.
By default Domino is saving .xml with "text/xml" MIME type. However I need it to be "application/xml".
Setting FileUpload control "MIME type" option does not help as Domino recognizes file type and changes it.
Is there a way to accomplish this task and manually switch attachment MIME type to a custom one?
You might want to look at "the other end". Instead of trying to alter the mime-type when saving (Which I actually doubt Domino does save!!!), change the way the file is served when retrieved. Instead of using the build in URL to access it, use an XAgent. There you can set the MIME-Type header to your hearts desire.
Edit:
The sneaky way: Don't do anything in your application. Talk to your admin. In the website configuration you can specify rules. Provide the pattern for the XML file and overwrite the mime-type header in the configuration. The admin documentation has all the details. You want to use the "custom header"

Handling zip files via media browser

I am using media module with wysiwyg integration of media browser.
I need to create a new file type (say zip) and have custom formatters for this file type. So, whenever a zip file is uploaded via media browser, i want it to get associated with "zip" file type and the formatters should be applied to it as selected by the user.
Tried to look for some tutorials but not much of help. Can someone please guide me through with this?
Thanks.

Resources