You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by lu...@apache.org on 2005/02/14 20:27:41 UTC

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup ContextConfig.java LocalStrings.properties

luehe       2005/02/14 11:27:41

  Modified:    catalina/src/share/org/apache/catalina/startup
                        ContextConfig.java LocalStrings.properties
  Log:
  Use configuration from alt-dd if specified.
  (Setter for alt-dd had been added to StandardContext, but this info was never used.)
  
  Revision  Changes    Path
  1.62      +27 -6     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ContextConfig.java
  
  Index: ContextConfig.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- ContextConfig.java	10 Feb 2005 22:25:55 -0000	1.61
  +++ ContextConfig.java	14 Feb 2005 19:27:41 -0000	1.62
  @@ -20,6 +20,7 @@
   
   import java.io.File;
   import java.io.FileInputStream;
  +import java.io.FileNotFoundException;
   import java.io.IOException;
   import java.io.InputStream;
   import java.net.URL;
  @@ -32,6 +33,7 @@
   import org.apache.catalina.Container;
   import org.apache.catalina.Context;
   import org.apache.catalina.Engine;
  +import org.apache.catalina.Globals;
   import org.apache.catalina.Host;
   import org.apache.catalina.Lifecycle;
   import org.apache.catalina.LifecycleEvent;
  @@ -272,12 +274,27 @@
        */
       protected void applicationWebConfig() {
   
  +        String altDDName = null;
  +
           // Open the application web.xml file, if it exists
           InputStream stream = null;
           ServletContext servletContext = context.getServletContext();
  -        if (servletContext != null)
  -            stream = servletContext.getResourceAsStream
  -                (Constants.ApplicationWebXml);
  +        if (servletContext != null) {
  +            altDDName = (String)servletContext.getAttribute(
  +                                                        Globals.ALT_DD_ATTR);
  +            if (altDDName != null) {
  +                try {
  +                    stream = new FileInputStream(altDDName);
  +                } catch (FileNotFoundException e) {
  +                    log.error(sm.getString("contextConfig.altDDNotFound",
  +                                           altDDName));
  +                }
  +            }
  +            else {
  +                stream = servletContext.getResourceAsStream
  +                    (Constants.ApplicationWebXml);
  +            }
  +        }
           if (stream == null) {
               log.info(sm.getString("contextConfig.applicationMissing") + " " + context);
               return;
  @@ -293,8 +310,12 @@
           // Process the application web.xml file
           synchronized (webDigester) {
               try {
  -                url =
  -                    servletContext.getResource(Constants.ApplicationWebXml);
  +                if (altDDName != null) {
  +                    url = new File(altDDName).toURL();
  +                } else {
  +                    url = servletContext.getResource(
  +                                                Constants.ApplicationWebXml);
  +                }
                   if( url!=null ) {
                       InputSource is = new InputSource(url.toExternalForm());
                       is.setByteStream(stream);
  
  
  
  1.13      +1 -0      jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- LocalStrings.properties	1 Feb 2005 13:12:31 -0000	1.12
  +++ LocalStrings.properties	14 Feb 2005 19:27:41 -0000	1.13
  @@ -29,6 +29,7 @@
   contextConfig.tldJarException=Exception processing JAR at resource path {0} in context {1}
   contextConfig.tldResourcePath=Invalid TLD resource path {0}
   contextConfig.unavailable=Marking this application unavailable due to previous error(s)
  +contextConfig.altDDNotFound=alt-dd file {0} not found
   embedded.alreadyStarted=Embedded service has already been started
   embedded.noEngines=No engines have been defined yet
   embedded.notmp=Cannot find specified temporary folder at {0}
  
  
  

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


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup ContextConfig.java LocalStrings.properties

Posted by Jan Luehe <Ja...@Sun.COM>.
Remy,

Remy Maucherat wrote:
> luehe@apache.org wrote:
>
>>luehe       2005/02/14 11:27:41
>>
>>  Modified:    catalina/src/share/org/apache/catalina/startup
>>                        ContextConfig.java LocalStrings.properties
>>  Log:
>>  Use configuration from alt-dd if specified.
>>  (Setter for alt-dd had been added to StandardContext, but this info
was never used.)
>
>
> What's the use of that ? I see it could be useful to deviate from the
> standard, but that's it ...

Yes, this is useful for when your web module is deployed as part of a
J2EE application inside a J2EE container. According to J2EE.8.3.1
("Assembling a J2EE Application"), step 3:

  The deployment descriptors for the J2EE modules must be edited to link
  internally satisfied dependencies and eliminate any redundant security
  role names. An optional element alt-dd [...] may be used when it is
  desirable to preserve the original deployment descriptor. The element
  alt-dd specifies an alternate deployment descriptor to use at
  deployment time.

> I suppose the field was lying around from TC 4.0, and not actually used,
> right ?

According to cvs, this StandardContext property was added in
TOMCAT_5_0_1.


Jan




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


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup ContextConfig.java LocalStrings.properties

Posted by Remy Maucherat <re...@apache.org>.
luehe@apache.org wrote:
> luehe       2005/02/14 11:27:41
> 
>   Modified:    catalina/src/share/org/apache/catalina/startup
>                         ContextConfig.java LocalStrings.properties
>   Log:
>   Use configuration from alt-dd if specified.
>   (Setter for alt-dd had been added to StandardContext, but this info was never used.)

What's the use of that ? I see it could be useful to deviate from the 
standard, but that's it ...
I suppose the field was lying around from TC 4.0, and not actually used, 
right ?

Rémy

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