cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject Re: FW: ResourceReader mime type auto-detection
Date Tue, 30 May 2006 17:11:07 GMT
If I'm not mistaken, it basically falls back to doing:

java.net.URLConnection.getFileNameMap().getContentTypeFor(fileName);

Javadocs of getFileNameMap say:

"Loads filename map (a mimetable) from a data file. It will first try to
load the user-specific table, defined by "content.types.user.table"
property. If that fails, it tries to load the default built-in table at
lib/content-types.properties under java home."

On Tue, 2006-05-30 at 17:20 +0100, Andrew Stevens wrote:
> No response over in users@, so perhaps I'll have more luck here? :-)
> 
> 
> Andrew.
> 
> 
> >From: "Andrew Stevens" <ats37@hotmail.com>
> >Date: Fri, 26 May 2006 13:08:56 +0100
> >
> >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.
> 
> 
-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


Mime
View raw message