cancel
Showing results for 
Search instead for 
Did you mean: 

How to change "Content-Type" of static resource files in WebEngine

erdmann_
Champ on-the-rise
Champ on-the-rise

The files below "skin/resources/". (as said by http://doc.nuxeo.com/display/NXDOC/WebEngine+%28JAX-RS%29#WebEngine%28JAX-RS%29-Staticresources) File is found, but with bad mimetype "text/plain" instead of "video/ogg":

    oe@charlie:~$ wget -S http://marcie:8080/nuxeo/site/portal/skin/images/demomedia/intro.ogv
--2012-08-24 12:45:01--  http://marcie:8080/nuxeo/site/portal/skin/images/demomedia/intro.ogv
Resolving marcie... 10.0.0.19
Connecting to marcie|10.0.0.19|:8080... connected.
HTTP request sent, awaiting response...
  HTTP/1.1 200 OK
  Set-Cookie: JSESSIONID=B85FEF72FA26C01B5A4F8DE20BA15B83.nuxeo; Path=/nuxeo
  Last-Modified: Thu, 23 Feb 2012 14:58:36 GMT
  Cache-Control: public
  Server: Nuxeo/WebEngine-1.0
  Content-Type: text/plain
  Content-Length: 1132834
  Date: Fri, 24 Aug 2012 10:45:04 GMT
  Connection: keep-alive
Length: 1132834 (1.1M) [text/plain]

I succssfully can change the mime-type for the non-WebEngine public directory (below nxserver\nuxeo.war), I guess, these files are almost untoched by nuxeo, hence the tomcat way works: in file deployment-fragment.xml add:

<extension target="web#SERVLET">
	<mime-mapping>
		<extension>ogv</extension>
		<mime-type>video/ogg</mime-type>
	</mime-mapping>

now it works for the file http://localhost:8080/nuxeo/portal/intro.ogv (notice the missing "site/").

    oe@charlie:~$ wget -S http://marcie:8080/nuxeo/portal/intro.ogv
--2012-08-24 12:46:21--  http://marcie:8080/nuxeo/portal/intro.ogv
Resolving marcie... 10.0.0.19
Connecting to marcie|10.0.0.19|:8080... connected.
HTTP request sent, awaiting response...
  HTTP/1.1 200 OK
  Server: Apache-Coyote/1.1
  Accept-Ranges: bytes
  ETag: W/"1132834-1330009116000"
  Last-Modified: Thu, 23 Feb 2012 14:58:36 GMT
  Content-Type: video/ogg
  Content-Length: 1132834
  Date: Fri, 24 Aug 2012 10:46:24 GMT
  Connection: keep-alive
Length: 1132834 (1.1M) [video/ogg]

How to change it for WebEngine? I guessed an extenstion point, but the one I found http://explorer.nuxeo.org/nuxeo/site/distribution/Nuxeo%20Platform-5.6-RC3/viewComponent/org.nuxeo.e...

has it already set:

<mimetype normalized="video/ogg" binary="true" iconPath="video.png">
  <mimetypes>
    <mimetype>video/ogg</mimetype>
  </mimetypes>
  <extensions>
    <extension>ogv</extension>
  </extensions>
</mimetype>
1 ACCEPTED ANSWER

Benjamin_Jalon1
Elite Collaborator
Elite Collaborator

Did you try with renaming your file to *.ogg, I think the mime type exposed will be application/ogg. I'm not a specialist but I think it may work.

Any way I think one way to add this mimetype is to add it in our nuxeo-webengine-core project this mimetype in the OSGI-INF/mimetype.properties.

I wait your feedback on the first point

View answer in original post

6 REPLIES 6

Benjamin_Jalon1
Elite Collaborator
Elite Collaborator

Did you try with renaming your file to *.ogg, I think the mime type exposed will be application/ogg. I'm not a specialist but I think it may work.

Any way I think one way to add this mimetype is to add it in our nuxeo-webengine-core project this mimetype in the OSGI-INF/mimetype.properties.

I wait your feedback on the first point

Thanks for the hint.

Thanks for your feedback, and please use answers for answers and comment for comment. This is important for the readability of this website. Other users that will read your question will acces the real answers easily. Also mark my answer as the one that has work for you.

I [add the line on the trunk][1] of Nuxeo, but I need to wait to add it into the first Hot Fix package as the release is in progress.

If its still in progress, the same for audio would be nice and in accordance with the RFC http

Ok I add [it][1]. Backport for 5.6 and 5.5 available soon.

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.