cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@locus.apache.org
Subject cvs commit: xml-cocoon/webapp/WEB-INF web.xml
Date Fri, 29 Dec 2000 16:55:21 GMT
bloritsch    00/12/29 08:55:20

  Modified:    src/org/apache/cocoon/components/language/markup/xsp/java
                        Tag: xml-cocoon2 esql.xsl
               src/org/apache/cocoon/servlet Tag: xml-cocoon2
                        CocoonServlet.java
               webapp/WEB-INF Tag: xml-cocoon2 web.xml
  Log:
  Fixed some initialization issues.  We won't have as many Sitemap unavailable problems
  any more.  Provided defaults for just about every initial parameter (except force-load and
  classpath-attribute which are hacks around differing servlet containers anyway).
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.18  +3 -3      xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/java/Attic/esql.xsl
  
  Index: esql.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/java/Attic/esql.xsl,v
  retrieving revision 1.1.2.17
  retrieving revision 1.1.2.18
  diff -u -r1.1.2.17 -r1.1.2.18
  --- esql.xsl	2000/12/22 14:59:25	1.1.2.17
  +++ esql.xsl	2000/12/29 16:55:17	1.1.2.18
  @@ -1,5 +1,5 @@
   <?xml version="1.0"?>
  -<!-- $Id: esql.xsl,v 1.1.2.17 2000/12/22 14:59:25 bloritsch Exp $-->
  +<!-- $Id: esql.xsl,v 1.1.2.18 2000/12/29 16:55:17 bloritsch Exp $-->
   <!--
   
    ============================================================================
  @@ -249,14 +249,14 @@
         try {
             esqlSession.maxRows = Integer.parseInt(String.valueOf(<xsl:copy-of select="$max-rows"/>).trim());
         } catch (Exception esqlE) {
  -          cocoonLogger.debug("Row retrieval is not limited", esqlE);
  +          cocoonLogger.debug("Row retrieval is not limited");
             esqlSession.maxRows = -1;
         }
   
         try {
              esqlSession.skipRows = Integer.parseInt(String.valueOf(<xsl:copy-of select="$skip-rows"/>).trim());
         } catch (Exception esqlE) {
  -          cocoonLogger.debug("We are not skipping any rows", esqlE);
  +          cocoonLogger.debug("We are not skipping any rows");
             esqlSession.skipRows = 0;
         }
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.41  +49 -22    xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java
  
  Index: CocoonServlet.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java,v
  retrieving revision 1.1.4.40
  retrieving revision 1.1.4.41
  diff -u -r1.1.4.40 -r1.1.4.41
  --- CocoonServlet.java	2000/12/18 16:55:22	1.1.4.40
  +++ CocoonServlet.java	2000/12/29 16:55:19	1.1.4.41
  @@ -53,16 +53,16 @@
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
    * @author <a href="mailto:nicolaken@supereva.it">Nicola Ken Barozzi</a> Aisa
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.1.4.40 $ $Date: 2000/12/18 16:55:22 $
  + * @version CVS $Revision: 1.1.4.41 $ $Date: 2000/12/29 16:55:19 $
    */
   
   public class CocoonServlet extends HttpServlet {
   
       private Logger log;
   
  -    final long second = 1000;
  -    final long minute = 60 * second;
  -    final long hour   = 60 * minute;
  +    static final long second = 1000;
  +    static final long minute = 60 * second;
  +    static final long hour   = 60 * minute;
   
       private long creationTime = 0;
       private Cocoon cocoon;
  @@ -145,6 +145,10 @@
        * For other servlet containers, please consult your manuals or
        * put Cocoon in the System Classpath.
        *
  +     * If you need to do this for more than one classpath attribute, then
  +     * separate each entry with whitespace, a comma, or a semi-colon.
  +     * Cocoon will strip any whitespace from the entry.
  +     *
        * @param classpathAttribute The classpath attribute to lookup.
        * @param context            The ServletContext to perform the lookup.
        *
  @@ -152,16 +156,35 @@
        */
        private void setClassPath(final String classpathAttribute, final ServletContext context)
        throws ServletException {
  +        StringBuffer buildClassPath = new StringBuffer();
  +
           if (classpathAttribute != null) {
  -            this.classpath = (String) context.getAttribute(classpathAttribute.trim());
  -        } else {
  -            this.classpath = System.getProperty("java.class.path");
  +            StringTokenizer classpathTokenizer = new StringTokenizer(classpathAttribute,
" \t\r\n\f;,", false);
  +
  +            while (classpathTokenizer.hasMoreTokens()) {
  +                final String localClasspath = classpathTokenizer.nextToken().trim();
  +
  +                if (localClasspath != null) {
  +	                if (buildClassPath.length() > 0) {
  +	                    buildClassPath.append(";");
  +	                }
  +	
  +	                log.debug("Using attribute: " + localClasspath.trim());
  +	                buildClassPath.append((String) context.getAttribute(localClasspath.trim()));
  +                }
  +            }
           }
  +
  +        if (buildClassPath.length() == 0) {
  +            buildClassPath.append(System.getProperty("java.class.path"));
  +        }
  +
  +        this.classpath = buildClassPath.toString();
        }
   
       /**
        * Set up the log level and path.  The default log level is
  -     * Priority.DEBUG, although it can be overwritten by the parameter
  +     * Priority.ERROR, although it can be overwritten by the parameter
        * "log-level".  The log system goes to both a file and the Servlet
        * container's log system.  Only messages that are Priority.ERROR
        * and above go to the servlet context.  The log messages can
  @@ -181,7 +204,7 @@
           if (logLevel != null) {
               logPriority = LogKit.getPriorityForName(logLevel);
           } else {
  -            logPriority = Priority.DEBUG;
  +            logPriority = Priority.ERROR;
           }
   
           try {
  @@ -210,17 +233,22 @@
        */
       private void setConfigFile(final String configFileName, final ServletContext context)
       throws ServletException {
  +        final String usedFileName;
           if (configFileName == null) {
  -            throw new ServletException("Servlet initialization argument 'configurations'
not specified");
  +            log.warn("Servlet initialization argument 'configurations' not specified, attempting
to use '/cocoon.xconf'");
  +            usedFileName = "/cocoon.xconf";
  +            // throw new ServletException("Servlet initialization argument 'configurations'
not specified");
  +        } else {
  +            usedFileName = configFileName;
           }
   
  -        log.info("Using configuration file: " + configFileName);
  +        log.debug("Using configuration file: " + usedFileName);
   
           try {
  -            this.configFile = this.context.getResource(configFileName);
  +            this.configFile = this.context.getResource(usedFileName);
           } catch (Exception mue) {
  -            log.error("Servlet initialization argument 'configurations' not found at "
+ configFileName, mue);
  -            throw new ServletException("Servlet initialization argument 'configurations'
not found at " + configFileName);
  +            log.error("Servlet initialization argument 'configurations' not found at "
+ usedFileName, mue);
  +            throw new ServletException("Servlet initialization argument 'configurations'
not found at " + usedFileName);
           }
       }
   
  @@ -232,27 +260,26 @@
        * set "force-load" to "com.ibm.servlet.classloader.Handler".
        *
        * If you need to force more than one class to load, then
  -     * separate each entry with a comma.  Cocoon will strip any
  -     * whitespace from the entry.
  +     * separate each entry with whitespace, a comma, or a semi-colon.
  +     * Cocoon will strip any whitespace from the entry.
        *
        * @param forceLoading The array of fully qualified classes to force loading.
        *
        * @throws ServletException
        */
  -    private void forceLoad(final String forceLoading)
  -    throws ServletException {
  +    private void forceLoad(final String forceLoading) {
           if (forceLoading != null) {
  -            StringTokenizer fqcnTokenizer = new StringTokenizer(forceLoading, ",", false);
  +            StringTokenizer fqcnTokenizer = new StringTokenizer(forceLoading, " \t\r\n\f;,",
false);
   
               while (fqcnTokenizer.hasMoreTokens()) {
                   final String fqcn = fqcnTokenizer.nextToken().trim();
   
                   try {
  +                    log.debug("Trying to load class: " + fqcn);
                       ClassUtils.loadClass(fqcn);
                   } catch (Exception e) {
  -                    log.error("Could not force-load class: " + fqcn, e);
  -                    throw new ServletException("Could not force-load the required class:
" +
  -                              fqcn + "\n" + e.getMessage(), e);
  +                    log.warn("Could not force-load class: " + fqcn, e);
  +                    // Do not throw an exception, because it is not a fatal error.
                   }
               }
           }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.8   +16 -12    xml-cocoon/webapp/WEB-INF/Attic/web.xml
  
  Index: web.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/webapp/WEB-INF/Attic/web.xml,v
  retrieving revision 1.1.2.7
  retrieving revision 1.1.2.8
  diff -u -r1.1.2.7 -r1.1.2.8
  --- web.xml	2000/12/18 15:01:25	1.1.2.7
  +++ web.xml	2000/12/29 16:55:20	1.1.2.8
  @@ -21,28 +21,32 @@
     </init-param>
     <init-param>
      <param-name>classpath-attribute</param-name>
  -   <!-- This is for Tomcat -->
  -   <param-value>org.apache.tomcat.jsp_classpath</param-value>
   
  -   <!-- Alternatively you can choose one of these:
  -        Catalina: org.apache.catalina.jsp_classpath
  -        Resin:    caucho.class.path
  -        IBM:      com.ibm.websphere.servlet.application.classpath
  -   -->
  +   <!-- Remove the ones you don't need. -->
  +   <param-value>
  +     <!-- This is for Tomcat 3.x -->
  +     org.apache.tomcat.jsp_classpath
  +
  +     <!-- This is for Tomcat 4.x -->
  +     org.apache.catalina.jsp_classpath
  +
  +     <!-- This is for Coucho Resin -->
  +     caucho.class.path
  +
  +     <!-- This is for IBM WebSphere -->
  +     com.ibm.websphere.servlet.application.classpath
  +   </param-value>
     </init-param>
     <init-param>
      <param-name>log-level</param-name>
      <param-value>DEBUG</param-value>
     </init-param>
  -  <!-- Only uncomment this if you need it!  Otherwise Cocoon will
  -       not start because it can't load a class!
  -
  -       For IBM WebSphere:
       <init-param>
         <param-name>force-load</param-name>
  +
  +      <!-- For IBM WebSphere: -->
         <param-value>com.ibm.servlet.classloader.Handler</param-value>
       </init-param>
  -  -->
    </servlet>
    <servlet-mapping>
     <servlet-name>Cocoon2</servlet-name>
  
  
  

Mime
View raw message