dims        01/07/19 03:46:32

  Modified:    xdocs    faq.xml
  Log:
  2 FAQ Content from Luca converted into FAQ.xml patch by John.
  
  Revision  Changes    Path
  1.8       +107 -0    xml-cocoon2/xdocs/faq.xml
  
  Index: faq.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/xdocs/faq.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- faq.xml   2001/07/19 09:45:38     1.7
  +++ faq.xml   2001/07/19 10:46:32     1.8
  @@ -325,4 +325,111 @@
      </p>
    </answer>
   </faq>
  +<faq>
  + <question>How could I have my Cocoon app in an URI other than
  +   &lt;you-server&gt;/cocoon/&lt;my-app&gt;?
  + </question>
  + <answer>
  +   <p>Note: This entry refers only to an Apache + Tomcat + Cocoon configuration,
  +     and was tested under: Windows NT 4.0 + Apache 1.3.14 + Tomcat 3.2 + Cocoon
  +     2.0b1.
  +   </p>
  +   <p>Test whether Tomcat passes everything under the /cocoon context to
  +     Cocoon. This may be tested by pointing your browser at
  +     &lt;your-server&gt;:8080/cocoon/xsp/simple, if a text page named
  +     "A simple XSP page", everything's fine.
  +   </p>
  +   <p>Now, suppose:</p>
  +   <ol>
  +     <li>you have a Cocoon application named "foo" which works fine when
  +       called with &lt;your-server&gt;:8080/cocoon/foo
  +     </li>
  +     <li>you want the "foo" app to be called from
  +       &lt;your-server&gt;:8080/foo instead.
  +     </li>
  +   </ol>
  +   <p>The idea is just to redirect the desidered URI (foo) to the one within
  +     the cocoon context (cocoon/foo).
  +   </p>
  +   <p>Since this has to be done before the URI is processed by Tomcat, it is
  +     just natural to use Apache for this. And, of course the user should not
  +     notice the redirection.
  +   </p>
  +   <p>Apache has an handy feature called mod_rewrite which does just this: URI
  +     rewriting (see the "URL Rewriting Guide" in the Apache user's guide for
  +     details).
  +   </p>
  +   <p>First of all, you should instruct Apache to load the mod_rewrite, hence,
  +     you should add (on a Windows system) this line to the httpf.conf:
  +   </p>
  +   <source>LoadModule rewrite_module modules/ApacheModuleRewrite.dll</source>
  +   <p>(by the way, most probably, this line is already on the httpd.conf, you
  +     just have to un-comment it).
  +   </p>
  +   <p>Add this line to httpd.conf in order to activate mod_rewrite:</p>
  +   <source>RewriteEngine On</source>
  +   <p>It is highly recommended to use the logging option of mod_rewrite, in
  +     order to check the correctness of the URI rewriting; just add this lines
  +     to the httpd.conf:</p>
  +   <source>
  +RewriteLog "C:/logs/rewrite.log"
  +RewriteLogLevel 9
  +   </source>
  +   <p>The first line tells Apache to put the URI rewriting log in the
  +     c:\logs\rewrite.log file (which happens to be on a Windows system, of
  +     course). The second one tells Apache to record everything mod_rewrite
  +     does, if you don't want to log anything, just set the RewriteLogLevel to
  +     0.
  +   </p>
  +   <p>Now, it's time to do the URI rewriting trick:</p>
  +   <source>RewriteRule foo/(.*) /cocoon/foo/$1 [PT]</source>
  +   <p>This line instructs Apache to redirect everything under "foo" to
  +     "cocoon/foo" and passes it on to other processing ("[PT]" option),
  +     like mod_alias.
  +   </p>
  +   <p>Now, just restart Apache and point your browser to:</p>
  +   <source>&lt;your-server&gt;:8080/foo/&lt;something&gt;...</source>
  +   <p>it should work just fine.</p>
  + </answer>
  +</faq>
  +<faq>
  + <question>How could I have my Cocoon app in a directory other than
  +   $TOMCAT_HOME/webapps/cocoon/&lt;my-app&gt;?
  + </question>
  + <answer>
  +   <p>Note: This entry refers only to an Apache + Tomcat + Cocoon configuration,
  +     and was tested under: Windows NT 4.0 + Apache 1.3.14 + Tomcat 3.2 + Cocoon
  +     2.0b1.
  +   </p>
  +   <p>Let's suppose the following:</p>
  +   <ol>
  +     <li>you have an application called "foo" which works perfectly when
  +       located under the %TOMCAT_HOME%\webapps\cocoon\foo directory.
  +     </li>
  +     <li>you want it to be located under the "c:\foo" directory instead</li>
  +   </ol>
  +   <p>This could be done pretty easily twisting a little bit the sitemap. The
  +     idea is to mount the sub-sitemap of the "foo" application on a specific
  +     location on the file system, rather than under the deafult cocoon context.
  +   </p>
  +   <p>Here's the sitemap.xmap fragment used to do this:</p>
  +   <source>
  +   <![CDATA[
  +<map:pipeline>
  + <map:match pattern="foo/**">
  +  <map:mount uri-prefix="foo" src="file:///c:/foo/"/>
  + </map:match>
  +</map:pipeline>
  +   ]]>
  +   </source>
  +   <p>The "file:" type of source forces Cocoon to search the sub-sitemap under
  +     the specified directory (which happens to be "c:\foo", since this is a
  +     Windows system).
  +   </p>
  +   <p>Now, you just need to copy everything which was under the
  +     webapps/cocoon/foo directory to the /foo directory, and it should work
  +     graciously.
  +   </p>
  + </answer>
  +</faq>
   </faqs>
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to