cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Stevens" <at...@hotmail.com>
Subject ResourceReader mime type auto-detection
Date Fri, 26 May 2006 12:08:56 GMT
Hi,

I have a pipeline that needs to serve up static files of any type from a 
particular directory.  And yes, I know it'd be more efficient to just have 
the web server do it, but we don't control the server that hosts it and 
there's constraints on the configuration & deployment process that mean we 
have to do it this way.  Previously, I was using a matcher for each file 
extension, and specifying the corresponding mime-type parameter in the 
map:read.  However, I gather that if no mime-type is specified the resource 
reader is supposed to determine the mime type automatically using 
inputSource.getMimeType() on the (Excalibur) Source.  So I tried replacing 
my multiple matchers with just

<map:match pattern="staticfiles/**">
<map:read src="files/{1}"/>
</map:match>

For PDFs and image files, this works just fine.  However, MS 
Word/Excel/Powerpoint files are displayed as text/binary within the browser 
window rather than prompting to download or open them in the relevant 
application.  SWF files are also displayed as text rather than in the Flash 
player/plugin.  This appears to be because the Content-Type header is being 
sent back as "text/html; charset=ISO-8859-1" rather than e.g. 
application/vnd.ms-excel
I haven't checked every file type we use (yet) so there may be others that 
also have the problem.

Is this a known limitation of the resource reader?  Does it only recognise 
certain file types, or is there something else going on I'm not aware of 
(e.g. missing some configuration somewhere)?  I'm using Cocoon 2.1.7, 
although the current SVN version on the 2_1_X branch doesn't appear to be 
any different.


Andrew.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message