tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Vowles" <rvow...@sew.co.nz>
Subject Re: Multi-homing/Virtual named hosts
Date Sun, 02 Apr 2000 01:37:05 GMT
Ok, makes sense now!

With that message you drew two threads together of things that I didn't
understand:

(a) The fact that when setContextManager is called on SimpleMapper, it does
this:

 this.cm=cm;
 // Add all context that are set in CM
 Enumeration enum=cm.getContextNames();
 while( enum.hasMoreElements() ) {
     String name=(String) enum.nextElement();
     try {
  Context ctx=cm.getContext( name );
  if(debug>0) ctx.log("Adding existing context " + name );
  addContext( cm, ctx );
     } catch (TomcatException ex ) {
  ex.printStackTrace();
     }
 }

- which in the ideal case would mean that it is subsuming all of the
contexts so that it can implement its own mapping. The only problem was that
when I followed the code (addContext()), it does absolutely nothing, which
meant that it was confusing to me. Now it makes sense, but it needs an
implementation.

(b) The purpose of a ContextMapper. I presumed it did what the classname
implied - it mapped something (presumably paths) to contexts, which it is
not entirely responsible for. Thats the purpose of the SimpleMapper.

As for the rest of your message, I'm going to have to go and look for those
other classes (Container & ContextGroup) to see what you are talking about.

My only remaining concern at this time is the changed structure of the XML
file when implementing VirtualHosts - I believe that to decide on a mapping
is a worthwhile thing so that I can progress. I'm not sure that putting
Context's under ContextManager's make sense any longer. Here's why:

    <ContextManager debug="0" home="." workDir="work" NAME="CTMGR1">
        <!-- ContextInterceptor
className="org.apache.tomcat.context.LogEvents" / -->
        <ContextInterceptor className="org.apache.tomcat.context.AutoSetup"
/>
        <ContextInterceptor
className="org.apache.tomcat.context.DefaultCMSetter" />
        <ContextInterceptor
className="org.apache.tomcat.context.WorkDirInterceptor" />
        <ContextInterceptor
className="org.apache.tomcat.context.WebXmlReader" />
        <ContextInterceptor
className="org.apache.tomcat.context.LoadOnStartupInterceptor" />
        <!-- Request processing -->
        <RequestInterceptor
className="org.apache.tomcat.request.SimpleMapper" debug="0" />
        <RequestInterceptor
className="org.apache.tomcat.request.SessionInterceptor" />
        <RequestInterceptor
className="org.apache.tomcat.request.SecurityCheck" />
        <RequestInterceptor className="org.apache.tomcat.request.FixHeaders"
/>
    </ContextManager>

    <ContextManager debug="0" home="." workDir="work" NAME="CTMGR2">
        <!-- ContextInterceptor
className="org.apache.tomcat.context.LogEvents" / -->
        <ContextInterceptor className="org.apache.tomcat.context.AutoSetup"
/>
        <ContextInterceptor
className="org.apache.tomcat.context.DefaultCMSetter" />
        <ContextInterceptor
className="org.apache.tomcat.context.WorkDirInterceptor" />
        <ContextInterceptor
className="org.apache.tomcat.context.WebXmlReader" />
        <ContextInterceptor
className="org.apache.tomcat.context.LoadOnStartupInterceptor" />
        <!-- Request processing -->
        <RequestInterceptor
className="org.apache.tomcat.request.SimpleMapper" debug="0" />
        <RequestInterceptor
className="org.apache.tomcat.request.SessionInterceptor" />
        <RequestInterceptor
className="org.apache.tomcat.request.SecurityCheck" />
        <RequestInterceptor className="org.apache.tomcat.request.FixHeaders"
/>
        <!-- Special Security mechanism - login or something -->
        <RequestInterceptor className="my.special.request.interceptor" />
    </ContextManager>

     <VirtualHost name="my.server.name.1" ip="a.b.c.d">
        <Connector className="org.apache.tomcat.service.SimpleTcpConnector">
            <Parameter name="handler"
value="org.apache.tomcat.service.http.HttpConnectionHandler"/>
            <Parameter name="port" value="8080"/>
        </Connector>

        <Connector className="org.apache.tomcat.service.SimpleTcpConnector">
            <Parameter name="handler"
value="org.apache.tomcat.service.connector.Ajp12ConnectionHandler"/>
            <Parameter name="port" value="8007"/>
        </Connector>

        <!-- example - how to override AutoSetup actions -->
        <Context path="/admin" docBase="webapps/examples" debug="0"
reloadable="true" ContextManager="CTXMGR2">
        </Context>
        <!-- example - how to override AutoSetup actions -->
        <Context path="" docBase="webapps/ROOT" debug="0" reloadable="true"
ContextManager="CTXMGR1">
        </Context>
     </VirtualHost>

     <VirtualHost name="my.server.name.2" ip="a.b.c.d">
        <Connector className="org.apache.tomcat.service.SimpleTcpConnector">
            <Parameter name="handler"
value="org.apache.tomcat.service.http.HttpConnectionHandler"/>
            <Parameter name="port" value="8080"/>
        </Connector>

        <Connector className="org.apache.tomcat.service.SimpleTcpConnector">
            <Parameter name="handler"
value="org.apache.tomcat.service.connector.Ajp12ConnectionHandler"/>
            <Parameter name="port" value="8007"/>
        </Connector>

        <!-- example - how to override AutoSetup actions -->
        <Context path="/examples" docBase="webapps/examples2" debug="0"
reloadable="true"  ContextManager="CTXMGR1">
        </Context>

        <!-- example - how to override AutoSetup actions -->
        <Context path="" docBase="webapps/ROOT2" debug="0" reloadable="true"
ContextManager="CTXMGR1">
        </Context>
      </VirtualHost>

I suppose the point I am trying to illustrate is one that you just made
yourself - a ContextManager is responsible only for knowing about all the
contexts that require certain handling (context interception and request
interception) and to allow the "stop" implementation. I don't see why a
VirtualHost can't use multiple contexts each of which may need different
facilities from different context managers. Or am I way off the rails here?

As for forcing me to accept one opinion over another, I'd rather come to a
concensus so that any code I write can be made available to others, as is
the general idea with this sort of thing...

---
Richard Vowles, Infrastructure Architect, Inprise New Zealand
home-email: "mailto:rvowles@sew.co.nz, work-email: "rvowles@inprise.com"


----- Original Message -----
From: Costin Manolache <costin@eng.sun.com>
To: <tomcat-dev@jakarta.apache.org>
Sent: Sunday, April 02, 2000 12:03 PM
Subject: Re: Multi-homing/Virtual named hosts




Mime
View raw message