tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Mooring <Chris.Moor...@connaught.plc.uk>
Subject RE: Overlapping contexts?
Date Mon, 23 Jan 2006 11:59:47 GMT
Hi Markus,

I just have to say that you are a champ!

I checked your proposed solution, and it seems to work fine. I will mess
around with it a bit and see how I go.

Thanks again,
Chris

-----Original Message-----
From: Markus Schönhaber [mailto:mailing-tomcat-user@schoenhaber.de] 
Sent: 23 January 2006 11:35
To: Tomcat Users List
Subject: Re: Overlapping contexts?

Chris Mooring wrote:
> I was just wondering if it is possible to have "overlapping contexts"? I
am
> not sure if this will make sense so I'll try and explain it with a little
> example;
>
> Basically, I'd like to be able to have two *similar* URL's map to separate
> locations on the filesystem;
>
> Example;
> localhost/myapp/index.jsp (refers to C:\myapp\index.jsp)
> localhost/myapp/external/index.jsp (refers to Z:\otherapp\index.jsp)
>
> Ideally, I'd like to achieve this using Tomcat's
>
> <Context path="/myapp" docBase="C:/myapp"
> ... >
> <Context path="/myapp/external" docBase="Z:/otherapp/"
> ... >
>
> element in server.xml. The important part here is that both contexts begin
> with /myapp!
>
> However, the last time I tried this, I had several different errors when
> Tomcat started up. I believe this may be due to the fact that with Tomcat
> 5.5 and above you shouldn't have context tags in server.xml. Therefore, I
> tried similar things in conf/context.xml with much similar results
> (errors). I then tried separate context files in
> C:\tomcat5\work\Catalina\localhost but this didn't work either.

If you store your <Context> information in individual files in
.../conf/Catalina/localhost
("conf", not "work"), the path-Attribute is ignored and the path information

is derived from the name of the XML-file. So if you want to define a 
<Context> which shall be accessible via
http://your.server/myapp
the XML-file has to be named "myapp.xml".
http://tomcat.apache.org/tomcat-5.5-doc/config/context.html
If the <Context>'s path shall contain slashes, replace them with "#" in the 
file name.
I don't know if this works but what you could try is the following:
put the two <Context>s you mention above each in an individual XML-file
under
.../conf/Catalina/localhost
and name the first "myapp.xml" and the second "myapp#external.xml".

Regards
  mks

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Connaught honoured AIM 'Decade of Excellence' Award 

Connaught awarded Partnering Contractor of the Year 2005 

Connaught wins AIM 'Company of the Year' award 2004 

West of England Business of the Year Award Winner 2003 

Why not visit our website http://www.connaught.plc.uk 

Disclaimer: 
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material.  Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.  If you received
this in error, please contact the sender and delete this message. 

Connaught plc, Head Office 01392 444546 

The presence of this footer indicates that this message has been scanned for
viruses by Network Associates Group Shield

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message