You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by SAXESS - Hussayn Dabbous <da...@saxess.com> on 2002/12/06 13:33:48 UTC

cocoon-sitemap, redirects and application default context

Hy;

I want to setup my webserver/appserver, so that it serves
a cocoon driven webapplication without exposing the cocoon
webapp in the URL and it redirects me to some initial page
of my cocoonapp. cocoon does not work as i expect in this
environment. But i found a workaround. Maybe someone could
comment on this and lead me to better understanding ?

here is what i have done in more detail:

this URL request  :  http://www.myserver.org/myapp
shall redirect to :  http://www.myserver.org/myapp/page/search

where myapp is the cocoon driven webapplication.

I use this combination of tools:

cocoon 2.0.3
apache 1.3.23
tomcat 4.1.12


1.) I have set a default context in tomcat's server.xml to cocoon
     and directed apache to forward all requests for "myapp" URLS
     to tomcat.

     Hence calls to http://www.myserver.org/myapp/...

     are all processed by cocoon. This part of the game is
     well understood and it works as expected.

2.) I put following entries into my master sitemap.xmap:

     <map:match pattern="myapp**">
       <map:mount check-reload="yes"
              src="myapp/"
              uri-prefix="myapp"/>
     </map:match>

     <map:match pattern="myapp/**">
       <map:mount check-reload="yes"
              src="myapp/"
              uri-prefix="myapp"/>
     </map:match>

     By this i expect all requests for /myapp... be controlled
     by myapp/sitemap.xmap  (Although i believe, the secnd
     match will never be processed ...)

     Also this works fine. The sub sitemap is mounted ...

3.) I put following entries into the sitemap.xmap of
     myapp/sitemap.xmap:

       <!-- homepage -->
       <map:match pattern="">
         <map:redirect-to session="false" uri="page/search"/>
       </map:match>
       <!-- homepage -->
       <map:match pattern="/">
         <map:redirect-to session="false" uri="page/search"/>
       </map:match>


Now, when i enter: "http://www.myserver.org/myapp"
i get an error stating, that the resource "/page/search" could not
be found on my server.

When i enter: http://www.myserver.org/myapp/
i will be correctly redirected to
http://www.myserver.org/myapp/page/search
and cocoon does, what i want it to do.


After some experiments i found, that following entry in the
master sitemap.xmap lets cocoon behave as expected:

  <map:match pattern="myapp">
    <map:redirect-to session="false" uri="myapp/"/>
  </map:match>
  <map:match pattern="myapp/**">
    <map:mount uri-prefix="myapp"
               check-reload="yes"
               reload-method="synchron"
               src="myapp/" />
  </map:match>

Now both URLs as stated above work fine.
Can anyone explain, why my first approach failed?
Or is there even a better and simpler solution for
my problem?

If this behaviour is "a feature", would this be something
to be described in the HOWTO section in the cocoon WIKI ?

best regards,
Hussayn


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