cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/servlet CocoonServlet.java
Date Mon, 05 Feb 2001 16:23:18 GMT
bloritsch    01/02/05 08:23:17

  Modified:    lib      Tag: xml-cocoon2 avalonapi.jar bsf.jar
               src/org/apache/cocoon Tag: xml-cocoon2
                        ProcessingException.java
               src/org/apache/cocoon/components/language/markup/sitemap/java
                        Tag: xml-cocoon2 sitemap.xsl
               src/org/apache/cocoon/generation Tag: xml-cocoon2
                        DirectoryGenerator.java FileGenerator.java
                        HTMLGenerator.java ServerPagesGenerator.java
               src/org/apache/cocoon/reading Tag: xml-cocoon2
                        ResourceReader.java
               src/org/apache/cocoon/servlet Tag: xml-cocoon2
                        CocoonServlet.java
  Log:
  Library updates and error correction on the sitemap.xsl file
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.14  +648 -341  xml-cocoon/lib/Attic/avalonapi.jar
  
  	<<Binary file>>
  
  
  1.1.2.3   +339 -308  xml-cocoon/lib/bsf.jar
  
  	<<Binary file>>
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.7   +15 -3     xml-cocoon/src/org/apache/cocoon/Attic/ProcessingException.java
  
  Index: ProcessingException.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/ProcessingException.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- ProcessingException.java	2000/07/29 18:30:26	1.1.2.6
  +++ ProcessingException.java	2001/02/05 16:23:03	1.1.2.7
  @@ -7,18 +7,30 @@
    *****************************************************************************/
   package org.apache.cocoon;
   
  +import org.apache.avalon.CascadingException;
  +
   /**
  + * This Exception is thrown every time there is a problem in processing
  + * a request.
    *
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
  - * @version CVS $Revision: 1.1.2.6 $ $Date: 2000/07/29 18:30:26 $
  + * @version CVS $Revision: 1.1.2.7 $ $Date: 2001/02/05 16:23:03 $
    */
  -public class ProcessingException extends Exception {
  +public class ProcessingException extends CascadingException {
   
       /**
        * Construct a new <code>ProcessingException</code> instance.
        */
       public ProcessingException(String message) {
  -        super(message);
  +        super(message, null);
  +    }
  +
  +    /**
  +     * Construct a new <code>ProcessingException</code> that references
  +     * a parent Exception.
  +     */
  +    public ProcessingException(String message, Throwable t) {
  +        super(message, t);
       }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.74  +8 -4      xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl
  
  Index: sitemap.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl,v
  retrieving revision 1.1.2.73
  retrieving revision 1.1.2.74
  diff -u -r1.1.2.73 -r1.1.2.74
  --- sitemap.xsl	2000/12/30 21:33:08	1.1.2.73
  +++ sitemap.xsl	2001/02/05 16:23:06	1.1.2.74
  @@ -62,6 +62,7 @@
   
       import org.apache.cocoon.Cocoon;
       import org.apache.cocoon.ProcessingException;
  +    import org.apache.cocoon.ResourceNotFoundException;
       import org.apache.cocoon.acting.Action;
       import org.apache.cocoon.environment.Environment;
       import org.apache.cocoon.matching.Matcher;
  @@ -78,7 +79,7 @@
        *
        * @author &lt;a href="mailto:Giacomo.Pati@pwr.ch"&gt;Giacomo Pati&lt;/a&gt;
        * @author &lt;a href="mailto:bloritsch@apache.org"&gt;Berin Loritsch&lt;/a&gt;
  -     * @version CVS $Revision: 1.1.2.73 $ $Date: 2000/12/30 21:33:08 $
  +     * @version CVS $Revision: 1.1.2.74 $ $Date: 2001/02/05 16:23:06 $
        */
       public class <xsl:value-of select="@file-name"/> extends AbstractSitemap {
         static final String LOCATION = "<xsl:value-of select="translate(@file-path, '/',
'.')"/>.<xsl:value-of select="@file-name"/>";
  @@ -329,6 +330,9 @@
             <xsl:variable name="pipeline-position" select="position()"/>
             try {
               <xsl:apply-templates select="./*"/>
  +          } catch (ResourceNotFoundException rse) {
  +            log.warn("404 Resource Not Found", rse);
  +            throw rse;
             } catch (Exception e) {
               log.warn("Error, try to process the error page", e);
               <xsl:choose>
  @@ -527,7 +531,7 @@
       <xsl:variable name="action-type">
         <xsl:call-template name="get-parameter">
           <xsl:with-param name="parname">type</xsl:with-param>
  -        <xsl:with-param name="default" value=""/>
  +        <xsl:with-param name="default">null</xsl:with-param>
         </xsl:call-template>
       </xsl:variable>
   
  @@ -587,7 +591,7 @@
       <xsl:variable name="action-type">
         <xsl:call-template name="get-parameter">
           <xsl:with-param name="parname">type</xsl:with-param>
  -        <xsl:with-param name="default" value=""/>
  +        <xsl:with-param name="default">null</xsl:with-param>
         </xsl:call-template>
       </xsl:variable>
   
  @@ -647,7 +651,7 @@
       <xsl:variable name="action-set">
         <xsl:call-template name="get-parameter">
           <xsl:with-param name="parname">set</xsl:with-param>
  -        <xsl:with-param name="default" value=""/>
  +        <xsl:with-param name="default">null</xsl:with-param>
         </xsl:call-template>
       </xsl:variable>
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.13  +24 -16    xml-cocoon/src/org/apache/cocoon/generation/Attic/DirectoryGenerator.java
  
  Index: DirectoryGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/DirectoryGenerator.java,v
  retrieving revision 1.1.2.12
  retrieving revision 1.1.2.13
  diff -u -r1.1.2.12 -r1.1.2.13
  --- DirectoryGenerator.java	2000/11/29 12:17:56	1.1.2.12
  +++ DirectoryGenerator.java	2001/02/05 16:23:08	1.1.2.13
  @@ -5,7 +5,7 @@
    * version 1.1, a copy of which has been included  with this distribution in *
    * the LICENSE file.                                                         *
    *****************************************************************************/
  - 
  +
   package org.apache.cocoon.generation;
   
   import java.io.File;
  @@ -23,6 +23,9 @@
   import org.apache.avalon.Parameters;
   import org.apache.avalon.Poolable;
   
  +import org.apache.cocoon.ProcessingException;
  +import org.apache.cocoon.ResourceNotFoundException;
  +
   /**
    * Generates an XML directory listing.
    * <p>
  @@ -56,8 +59,8 @@
    *
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
  - * @version CVS $Revision: 1.1.2.12 $ $Date: 2000/11/29 12:17:56 $ */
  - 
  + * @version CVS $Revision: 1.1.2.13 $ $Date: 2001/02/05 16:23:08 $ */
  +
   public class DirectoryGenerator extends ComposerGenerator implements Poolable {
   
       /** The URI of the namespace of this generator. */
  @@ -77,7 +80,7 @@
   
       /*
        * Variables set per-request
  -     * 
  +     *
        * FIXME: SimpleDateFormat is not supported by all locales!
        */
       protected int depth;
  @@ -99,24 +102,24 @@
        */
       public void setup(EntityResolver resolver, Map objectModel, String src, Parameters
par) {
           super.setup(resolver, objectModel, src, par);
  -    
  +
           String dateFormatString = par.getParameter("dateFormat", null);
  -    
  +
           if (dateFormatString != null) {
               this.dateFormatter = new SimpleDateFormat(dateFormatString);
           } else {
               this.dateFormatter = new SimpleDateFormat();
           }
  -    
  +
           this.depth = par.getParameterAsInteger("depth", 1);
  -    
  +
           /* Create a reusable attributes for creating nodes */
           AttributesImpl attributes = new AttributesImpl();
       }
   
       /**
        * Generate XML data.
  -     * 
  +     *
        * @throws  SAXException
        *      if an error occurs while outputting the document
        * @throws  IOException
  @@ -124,16 +127,17 @@
        *      filesystem
        */
       public void generate()
  -    throws SAXException, IOException {
  +    throws SAXException, ProcessingException {
  +        try {
   
           InputSource input;
           URL url;
           File path;
  -    
  +
           input = resolver.resolveEntity(null,super.source);
               url = new URL(input.getSystemId());
               path = new File(url.getFile());
  -    
  +
               if (!path.isDirectory()) {
                   throw new IOException("Cannot read directory from "
                         + url.toString() + "\"");
  @@ -144,6 +148,10 @@
           addPath(path, depth);
           this.contentHandler.endPrefixMapping(PREFIX);
           this.contentHandler.endDocument();
  +        } catch (IOException ioe) {
  +            log.warn("Could not get resource", ioe);
  +            throw new ResourceNotFoundException("Could not get directory", ioe);
  +        }
   
       }
   
  @@ -185,7 +193,7 @@
        *      the name of the new node
        * @param   path
        *      the file/directory to use when setting attributes
  -     * 
  +     *
        * @throws  SAXException
        *      if an error occurs while creating the node
        */
  @@ -196,8 +204,8 @@
       }
   
       /**
  -     * Sets the attributes for a given path. The default method sets attributes 
  -     * for the name of thefile/directory and for the last modification time 
  +     * Sets the attributes for a given path. The default method sets attributes
  +     * for the name of thefile/directory and for the last modification time
        * of the path.
        *
        * @param path
  @@ -227,7 +235,7 @@
        *      the name of the new node
        * @param   path
        *      the file/directory to use when setting attributes
  -     * 
  +     *
        * @throws  SAXException
        *      if an error occurs while closing the node
        */
  
  
  
  1.1.2.14  +3 -2      xml-cocoon/src/org/apache/cocoon/generation/Attic/FileGenerator.java
  
  Index: FileGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/FileGenerator.java,v
  retrieving revision 1.1.2.13
  retrieving revision 1.1.2.14
  diff -u -r1.1.2.13 -r1.1.2.14
  --- FileGenerator.java	2001/01/23 17:34:53	1.1.2.13
  +++ FileGenerator.java	2001/02/05 16:23:09	1.1.2.14
  @@ -16,6 +16,7 @@
   import org.apache.cocoon.components.parser.Parser;
   import org.apache.cocoon.components.store.Store;
   import org.apache.cocoon.ProcessingException;
  +import org.apache.cocoon.ResourceNotFoundException;
   import org.apache.cocoon.Roles;
   import org.apache.cocoon.xml.XMLCompiler;
   import org.apache.cocoon.xml.XMLInterpreter;
  @@ -56,7 +57,7 @@
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:cziegeler@sundn.de">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1.2.13 $ $Date: 2001/01/23 17:34:53 $
  + * @version CVS $Revision: 1.1.2.14 $ $Date: 2001/02/05 16:23:09 $
    */
   public class FileGenerator extends ComposerGenerator implements Poolable, Configurable
{
   
  @@ -173,7 +174,7 @@
               }
           } catch (IOException e) {
               log.error("FileGenerator.generate()", e);
  -            throw(e);
  +            throw new ResourceNotFoundException("FileGenerator could not find resource",
e);
           } catch (SAXException e) {
               log.error("FileGenerator.generate()", e);
               throw(e);
  
  
  
  1.1.2.6   +3 -3      xml-cocoon/src/org/apache/cocoon/generation/Attic/HTMLGenerator.java
  
  Index: HTMLGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/HTMLGenerator.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- HTMLGenerator.java	2000/12/20 23:12:46	1.1.2.5
  +++ HTMLGenerator.java	2001/02/05 16:23:10	1.1.2.6
  @@ -27,7 +27,7 @@
   
   /**
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
  - * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/12/20 23:12:46 $
  + * @version CVS $Revision: 1.1.2.6 $ $Date: 2001/02/05 16:23:10 $
    */
   public class HTMLGenerator extends ComposerGenerator implements Poolable {
       /**
  @@ -48,8 +48,8 @@
               DOMStreamer streamer = new DOMStreamer(this.contentHandler,this.lexicalHandler);
               streamer.stream(doc);
           } catch (IOException e){
  -            log.error("HTMLGenerator.generate()", e);
  -            throw(e);
  +            log.warn("HTMLGenerator.generate()", e);
  +            throw new ResourceNotFoundException("Could not get Resource for HTMLGenerator",
e);
           } catch (SAXException e){
               log.error("HTMLGenerator.generate()", e);
               throw(e);
  
  
  
  1.1.2.13  +5 -4      xml-cocoon/src/org/apache/cocoon/generation/Attic/ServerPagesGenerator.java
  
  Index: ServerPagesGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/ServerPagesGenerator.java,v
  retrieving revision 1.1.2.12
  retrieving revision 1.1.2.13
  diff -u -r1.1.2.12 -r1.1.2.13
  --- ServerPagesGenerator.java	2001/02/01 20:04:58	1.1.2.12
  +++ ServerPagesGenerator.java	2001/02/05 16:23:10	1.1.2.13
  @@ -29,6 +29,7 @@
   import org.xml.sax.SAXException;
   import java.net.MalformedURLException;
   import org.apache.cocoon.ProcessingException;
  +import org.apache.cocoon.ResourceNotFoundException;
   import org.apache.cocoon.Roles;
   import org.apache.avalon.Loggable;
   
  @@ -37,7 +38,7 @@
    * delegating actual SAX event generation.
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.12 $ $Date: 2001/02/01 20:04:58 $
  + * @version CVS $Revision: 1.1.2.13 $ $Date: 2001/02/05 16:23:10 $
    */
   public class ServerPagesGenerator
     extends ServletGenerator
  @@ -107,13 +108,13 @@
   
       URL url = new URL(systemId);
       if (!url.getProtocol().equals("file")) {
  -      throw new IOException("Not a file: " + url.toString());
  +      throw new ResourceNotFoundException("Not a file: " + url.toString());
       }
   
       File file = new File(url.getFile());
   
       if (!file.canRead()) {
  -      throw new IOException("Can't read file: " + url.toString());
  +      throw new ResourceNotFoundException("Can't read file: " + url.toString());
       }
   
       String markupLanguage = this.parameters.getParameter(
  @@ -130,7 +131,7 @@
           programGenerator.load(file, markupLanguage, programmingLanguage, resolver);
       } catch (Exception e) {
         log.warn("ServerPagesGenerator.generate()", e);
  -      throw new ProcessingException(e.getMessage());
  +      throw new ResourceNotFoundException(e.getMessage(), e);
       }
   
       if (generator instanceof Loggable) {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.12  +6 -5      xml-cocoon/src/org/apache/cocoon/reading/Attic/ResourceReader.java
  
  Index: ResourceReader.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/reading/Attic/ResourceReader.java,v
  retrieving revision 1.1.2.11
  retrieving revision 1.1.2.12
  diff -u -r1.1.2.11 -r1.1.2.12
  --- ResourceReader.java	2001/01/13 13:39:19	1.1.2.11
  +++ ResourceReader.java	2001/02/05 16:23:14	1.1.2.12
  @@ -24,13 +24,14 @@
   
   import org.apache.cocoon.Cocoon;
   import org.apache.cocoon.ProcessingException;
  +import org.apache.cocoon.ResourceNotFoundException;
   
   import org.xml.sax.SAXException;
   
   /**
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.11 $ $Date: 2001/01/13 13:39:19 $
  + * @version CVS $Revision: 1.1.2.12 $ $Date: 2001/02/05 16:23:14 $
    *
    * The <code>ResourceReader</code> component is used to serve binary data
    * in a sitemap pipeline. It makes use of HTTP Headers to determine if
  @@ -89,12 +90,12 @@
               }
           } catch (SAXException se) {
               log.error("ResourceReader: error resolving source \"" + source + "\"", se);
  -            throw new IOException ("ResourceReader: error resolving source \""
  -                +source+"\". "+se.toString());
  +            throw new ResourceNotFoundException ("ResourceReader: error resolving source
\""
  +                +source+"\". ", se);
           } catch (MalformedURLException mue) {
               log.error("ResourceReader: malformed source \"" + source + "\"", mue);
  -            throw new IOException ("ResourceReader: malformed source \""
  -                +src+"\". "+mue.toString());
  +            throw new ResourceNotFoundException ("ResourceReader: malformed source \""
  +                +src+"\". ", mue);
           }
           byte[] buffer = new byte[(int)len];
           is.read(buffer);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.49  +17 -1     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.48
  retrieving revision 1.1.4.49
  diff -u -r1.1.4.48 -r1.1.4.49
  --- CocoonServlet.java	2001/01/31 15:03:55	1.1.4.48
  +++ CocoonServlet.java	2001/02/05 16:23:15	1.1.4.49
  @@ -35,6 +35,7 @@
   import org.apache.cocoon.Cocoon;
   import org.apache.cocoon.Notifier;
   import org.apache.cocoon.Notification;
  +import org.apache.cocoon.ResourceNotFoundException;
   import org.apache.cocoon.environment.http.HttpEnvironment;
   import org.apache.cocoon.util.ClassUtils;
   import org.apache.cocoon.util.NetUtils;
  @@ -54,7 +55,7 @@
    * @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.48 $ $Date: 2001/01/31 15:03:55 $
  + * @version CVS $Revision: 1.1.4.49 $ $Date: 2001/02/05 16:23:15 $
    */
   
   public class CocoonServlet extends HttpServlet {
  @@ -368,6 +369,21 @@
                   n.addExtraDescription("path-info", uri);
                   Notifier.notify(n, req, res);
               }
  +        } catch (ResourceNotFoundException rse) {
  +            log.warn("The resource was not found", rse);
  +
  +            res.setStatus(res.SC_NOT_FOUND);
  +            Notification n = new Notification(this);
  +            n.setType("resource-not-found");
  +            n.setTitle("Resource not found");
  +            n.setSource("Cocoon servlet");
  +            n.setMessage("Resource not found");
  +            n.setDescription("The requested URI \""
  +                             + req.getRequestURI()
  +                             + "\" was not found.");
  +            n.addExtraDescription("request-uri", req.getRequestURI());
  +            n.addExtraDescription("path-info", uri);
  +            Notifier.notify(n, req, res);
           } catch (Exception e) {
               log.error("Problem with servlet", e);
               //res.setStatus(res.SC_INTERNAL_SERVER_ERROR);
  
  
  

Mime
View raw message