Hiding /cocoon from the URL (cookbook)

- TARGET-AUDIENCE: *beginner* advanced expert
- COCOON-RELEASES: 2.0.3, 2.0.4
- DOCUMENT-STATUS: *draft* reviewed released

What you will get from this page

I will show you, how you can get the /cocoon out of the URL. If you want to know how you can get your company server to use cocoon without exploiting the tomcat port (8080) you also need to read the document BeginnerDefaultPort.

This approach works for the apache/tomcat working horse. For other application servers this document is not applicable.

Your basic skills

Technical prerequisites

Configuring tomcat

In short terms you setup a tomcat default context, where cocoon happens to be the default webapplication to be triggered. Here we go:

Some notes on the Context attributes:

  1. By defining a <Context> with the path="" we have created a default Context. Now tomcat directs every request to Cocoon, which can not explicitly be associated to another webapplication.

  2. By setting docBase to an absolute path we have directed tomcat to mount the webapplication from that path. We could also have used a relative path, which would be resolved relative to $cocoon_root/webapps but beware ...:

Important NOTE: If you deploy cocoon into the default webapp directory AND setup a Context within server.xml for the same webapplication, it will be mounted twice: once for the default context and once via automatic mount from the webapps folder. This is true even if docBase points to $tomcat_root/webapps/cocoon!!! As this is probably NOT what you want to do, you must deploy cocoon elsewhere to avoid the automounting.

What did we achieve?


now points to the same place as the formerly used URL:


And now eliminate the port...

As stated at the beginning of this document, you may want to also eliminate the port from your URL. If you want to this, please read the accompanion document BeginnerDefaultPort.

page metadata

- AUTHOR:Hussayn Dabbous
- AUTHOR-CONTACT: mailto:Hussayn.Dabbous@saxess.de[[BR]] - REVIEWED-BY:[[BR]] - REVIEWER-CONTACT:[[BR]]

BeginnerDefaultContext (last edited 2009-09-20 23:41:56 by localhost)