FYI. Here are two entries from Luca.
Note: forwarded message attached.
=====
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
Davanum,
I've made this two FAQ entries related to Cocoon. I'd like you to assess
them for later insertion under the Cocoon2 site.
Best regards,
P.S.
I've put a version number on this document (0.0.1), in order to have a
little configuration control over it.
---------------------------------------------
Luca Morandini
GIS Consultant
[EMAIL PROTECTED]
+39 0744 59 85 1 Office
+39 0335 681 02 12 Mobile
http://utenti.tripod.it/lmorandini/index.html
---------------------------------------------
-------------------------------------------------------------------------------
FAQ's entris by Luca MOrandini [EMAIL PROTECTED]
Version 0.0.1 18/07/01
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
How could I have my Cocoon app in an URI other than
<you-server>/cocoon/<my-app> ?
-------------------------------------------------------------------------------
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.
Test whether Tomcat passes everything under the /cocoon context to
Cocoon. This may be tested by pointing your browser at
<your-server>:8080/cocoon/xsp/simple , if a text page named "A simple XSP
page", everything's fine.
Now, suppose:
1) you have a Cocoon application named "foo" which works fine when called with
<your-server>:8080/cocoon/foo
2) you want the "foo" app to be called from <your-server>:8080/foo
instead.
The idea is just to redirect the desidered URI (foo) to the one within the
cocoon context (cocoon/foo).
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.
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).
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:
LoadModule rewrite_module modules/ApacheModuleRewrite.dll
(by the way, most probably, this line is already on the httpd.conf, you just
have to un-comment it).
Add this line to httpd.conf in order to activate mod_rewrite:
RewriteEngine On
It is highly reccommended 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:
RewriteLog "C:/logs/rewrite.log"
RewriteLogLevel 9
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.
Now, it's time to do the URI rewriting trick:
RewriteRule foo/(.*) /cocoon/foo/$1 [PT]
This line instructs Apache to redirect everything under "foo" to "cocoon/foo"
and passes it on to other processing ("[PT]" option), like mod_alias.
Now, just restart Apache and point your browser to:
<your-server>:8080/foo/<something>... it should work just fine.
-------------------------------------------------------------------------------
How could I have my Cocoon app in a directory other than
$TOMCAT_HOME/webapps/cocoon/<my-app> ?
-------------------------------------------------------------------------------
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.
Let's suppose the following:
1) you have an application called "foo" which works perfectly
when located under the %TOMCAT_HOME%\webapps\cocoon\foo directory.
2) you want it to be located under the "c:\foo" directory instead
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.
Here's the sitemap.xmap fragment used to do this:
<map:pipeline>
<map:match pattern="foo/**">
<map:mount uri-prefix="foo" src="file:///c:/foo/"/>
</map:match>
</map:pipeline>
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).
Now, you just need to copy everything which was under the webapps/cocoon/foo
directory to the /foo directory, and it should work graciously.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]