You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by do...@cocoon.apache.org on 2005/01/16 11:15:17 UTC

[Cocoon Wiki] Updated: ServingStaticFiles

   Date: 2005-01-16T02:15:17
   Editor: MarkLundquist
   Wiki: Cocoon Wiki
   Page: ServingStaticFiles
   URL: http://wiki.apache.org/cocoon/ServingStaticFiles

   add comment, fix broken link, satisfy a TODO :-)

Change Log:

------------------------------------------------------------------------------
@@ -8,25 +8,30 @@
 
 The simplest way to achieve this is to use a [:Reader] (usually the {{{ResourceReader}}}, which is the default). E.g:
 
-{{{
-<map:match pattern="**.jar">
-   <map:read src="jars/{1}.jar" mime-type="application/java-archive"/>
-</map:match>
-<map:match pattern="**.css">
-   <map:read src="style/{1}.css" mime-type="text/css"/>
-</map:match>
-<map:match pattern="**.gif">
-   <map:read src="images/{1}.gif" mime-type="image/gif"/>
-</map:match>
-<map:match pattern="static-**.html">
-   <map:read src="html/{1}.html" mime-type="text/html"/>
-</map:match>
+{{{
+<map:match pattern="**.jar">
+   <map:read src="jars/{1}.jar" mime-type="application/java-archive"/>
+</map:match>
+<map:match pattern="**.css">
+   <map:read src="style/{1}.css" mime-type="text/css"/>
+</map:match>
+<map:match pattern="**.gif">
+   <map:read src="images/{1}.gif" mime-type="image/gif"/>
+</map:match>
+<map:match pattern="static-**.html">
+   <map:read src="html/{1}.html" mime-type="text/html"/>
+</map:match>
 }}}
 
-TODO: it's more efficient to serve static files from Apache or elsewhere. Need to include examples of how to do this[[BR]]
+----
+''IMHO this is overengineered, because in order to serve static content directly from Apache (see below) the URI-to-filesystem mapping in the example above must also be implemented in the Apache configuration.  Cocoon already needs a separate rule for each (in order to specify the MIME type), but Apache doesn't, so it's a pain to have to add it just so that URIs don't have to start with "images/", etc.''  --[wiki:MarkLundquist ML]
+----
+
+It's more efficient to serve static files from Apache (see SimpleModProxy), but we still want our Cocoon app to have the ability to serve static content all by itself without Apache, for when we're developing in a non-server (desktop/laptop) environment.
+
 TODO: show how the expires parameter can help
 
 === Mime types ===
 As you can see the reader needs the mime type (Multipurpose Internet Mail Extensions):
- *  [http://www.nacs.uci.edu/indiv/ehood/MIME/MIME.html Content Types and Subtypes as a list] (link broken as of 5 Dec 2003)
+ *  [http://www.iana.org/assignments/media-types/ Content Types and Subtypes as a list] 
  *  [http://ftp.isi.edu/in-notes/iana/assignments/media-types/media-types General information]