You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by bl...@locus.apache.org on 2000/11/15 20:29:44 UTC

cvs commit: xml-cocoon/src/org/apache/cocoon/sitemap AbstractSitemap.java

bloritsch    00/11/15 11:29:44

  Modified:    src/org/apache/cocoon/components/language/markup/sitemap/java
                        Tag: xml-cocoon2 sitemap.xsl
               src/org/apache/cocoon/components/language/programming Tag:
                        xml-cocoon2 AbstractProgrammingLanguage.java
               src/org/apache/cocoon/environment Tag: xml-cocoon2
                        AbstractEnvironment.java
               src/org/apache/cocoon/environment/http Tag: xml-cocoon2
                        HttpEnvironment.java
               src/org/apache/cocoon/serialization Tag: xml-cocoon2
                        SVGSerializer.java
               src/org/apache/cocoon/servlet Tag: xml-cocoon2
                        CocoonServlet.java
               src/org/apache/cocoon/sitemap Tag: xml-cocoon2
                        AbstractSitemap.java
  Log:
  Fixed some exception catches and added a couple log targets.
  
  Tried some stuff with redirect, but I found out my server is misconfigured.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.62  +5 -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.61
  retrieving revision 1.1.2.62
  diff -u -r1.1.2.61 -r1.1.2.62
  --- sitemap.xsl	2000/11/10 22:38:53	1.1.2.61
  +++ sitemap.xsl	2000/11/15 19:29:34	1.1.2.62
  @@ -77,7 +77,7 @@
        *
        * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
        * @author <a href="mailto:bloritsch@apache.org">Berin Loiritsch</a>
  -     * @version CVS $Revision: 1.1.2.61 $ $Date: 2000/11/10 22:38:53 $
  +     * @version CVS $Revision: 1.1.2.62 $ $Date: 2000/11/15 19:29:34 $
        */
       public class <xsl:value-of select="@file-name"/> extends AbstractSitemap {
         static {
  @@ -202,7 +202,7 @@
             load_component ("!transformer:link-translator!", "org.apache.cocoon.sitemap.LinkTranslator", new DefaultConfiguration(""), null);
   
             <!-- Configure generators -->
  -	  <xsl:call-template name="config-components">
  +      <xsl:call-template name="config-components">
               <xsl:with-param name="name">generator</xsl:with-param>
               <xsl:with-param name="components"
                   select="/map:sitemap/map:components/map:generators/map:generator"/>
  @@ -672,6 +672,7 @@
   
         <!-- redirect to a external resource definition. Let the environment do the redirect -->
         <xsl:when test="@uri">
  +        log.debug("Redirecting to '<xsl:value-of select="@uri"/>'");
           environment.redirect (substitute(listOfLists, "<xsl:value-of select="@uri"/>"));
           if(true)return true;
         </xsl:when>
  @@ -728,7 +729,7 @@
           <!-- get nested configuration definitions -->
           <xsl:call-template name="nested-config-components">
             <xsl:with-param name="name" select="$name"/>
  -	  <xsl:with-param name="level" select="2"/>
  +      <xsl:with-param name="level" select="2"/>
             <xsl:with-param name="config-name"><xsl:value-of select="concat(local-name(.),'/',@name)"/></xsl:with-param>
             <xsl:with-param name="components" select="*"/>
             <xsl:with-param name="type" select="@name"/>
  @@ -743,7 +744,7 @@
               load_component ("<xsl:value-of select="$name"/>:<xsl:value-of select="@name"/>", "<xsl:value-of select="@src"/>", cconf1, null);
             </xsl:otherwise>
           </xsl:choose>
  -	}
  +    }
         </xsl:if>
       </xsl:for-each>
     </xsl:template>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.8   +2 -1      xml-cocoon/src/org/apache/cocoon/components/language/programming/Attic/AbstractProgrammingLanguage.java
  
  Index: AbstractProgrammingLanguage.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/programming/Attic/AbstractProgrammingLanguage.java,v
  retrieving revision 1.1.2.7
  retrieving revision 1.1.2.8
  diff -u -r1.1.2.7 -r1.1.2.8
  --- AbstractProgrammingLanguage.java	2000/11/10 22:38:54	1.1.2.7
  +++ AbstractProgrammingLanguage.java	2000/11/15 19:29:37	1.1.2.8
  @@ -27,7 +27,7 @@
    * unloading.
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.7 $ $Date: 2000/11/10 22:38:54 $
  + * @version CVS $Revision: 1.1.2.8 $ $Date: 2000/11/15 19:29:37 $
    */
   public abstract class AbstractProgrammingLanguage
     implements ProgrammingLanguage, Configurable
  @@ -69,6 +69,7 @@
         }
       } catch (Exception e) {
          log.error("Error with \"code-formatter\" parameter", e);
  +       throw e;
       }
     }
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.6   +10 -5     xml-cocoon/src/org/apache/cocoon/environment/Attic/AbstractEnvironment.java
  
  Index: AbstractEnvironment.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/environment/Attic/AbstractEnvironment.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- AbstractEnvironment.java	2000/09/03 17:45:45	1.1.2.5
  +++ AbstractEnvironment.java	2000/11/15 19:29:37	1.1.2.6
  @@ -22,11 +22,16 @@
   
   import org.apache.cocoon.environment.Environment;
   
  +import org.apache.log.Logger;
  +import org.apache.log.LogKit;
  +
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
   
   public abstract class AbstractEnvironment implements Environment {
   
  +    protected Logger log = LogKit.getLoggerFor("cocoon");
  +
       /** The current uri in progress */
       protected String uri = null;
   
  @@ -45,7 +50,7 @@
       /**
        * Constructs the abstract enviornment
        */
  -    public AbstractEnvironment(String uri, String view, String context) 
  +    public AbstractEnvironment(String uri, String view, String context)
       throws MalformedURLException {
           this(uri, view, new File(context));
       }
  @@ -53,7 +58,7 @@
       /**
        * Constructs the abstract enviornment
        */
  -    public AbstractEnvironment(String uri, String view, File context) 
  +    public AbstractEnvironment(String uri, String view, File context)
       throws MalformedURLException {
           this.uri = uri;
           this.view = view;
  @@ -85,8 +90,8 @@
                   this.context = f.toURL();
               }
           } else {
  -            throw new RuntimeException("The current URI (" 
  -                + uri + ") doesn't start with given prefix (" 
  +            throw new RuntimeException("The current URI ("
  +                + uri + ") doesn't start with given prefix ("
                   + prefix + ")"
               );
           }
  @@ -96,7 +101,7 @@
        * Redirect the client to a new URL
        */
       public abstract void redirect(String newURL) throws IOException;
  -    
  +
       // Request methods
   
       /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.16  +52 -50    xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpEnvironment.java
  
  Index: HttpEnvironment.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpEnvironment.java,v
  retrieving revision 1.1.2.15
  retrieving revision 1.1.2.16
  diff -u -r1.1.2.15 -r1.1.2.16
  --- HttpEnvironment.java	2000/10/06 21:25:28	1.1.2.15
  +++ HttpEnvironment.java	2000/11/15 19:29:41	1.1.2.16
  @@ -5,56 +5,56 @@
    * version 1.1, a copy of which has been included  with this distribution in *
    * the LICENSE file.                                                         *
    *****************************************************************************/
  - 
  +
   package org.apache.cocoon.environment.http;
   
  -import java.io.File; 
  -import java.io.IOException; 
  -import java.io.OutputStream; 
  -import java.net.MalformedURLException; 
  -import java.net.URL; 
  -import java.util.Map; 
  +import java.io.File;
  +import java.io.IOException;
  +import java.io.OutputStream;
  +import java.net.MalformedURLException;
  +import java.net.URL;
  +import java.util.Map;
   
  -import javax.servlet.ServletContext; 
  -import javax.servlet.http.HttpServletRequest; 
  +import javax.servlet.ServletContext;
  +import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   
   import org.apache.cocoon.Cocoon;
  -import org.apache.cocoon.environment.AbstractEnvironment; 
  - 
  -import org.xml.sax.InputSource; 
  -import org.xml.sax.SAXException; 
  +import org.apache.cocoon.environment.AbstractEnvironment;
  +
  +import org.xml.sax.InputSource;
  +import org.xml.sax.SAXException;
   
   public class HttpEnvironment extends AbstractEnvironment {
   
       /** The HttpServletRequest */
       private HttpRequest request = null;
       private HttpServletRequest servletRequest = null;
  +
  +    /** The HttpServletResponse */
  +    private HttpResponse response = null;
  +    private HttpServletResponse servletResponse = null;
  +
  +    /** The ServletContext */
  +    private ServletContext servletContext = null;
  +
  +    /** The OutputStream */
  +    private OutputStream outputStream = null;
   
  -    /** The HttpServletResponse */ 
  -    private HttpResponse response = null; 
  -    private HttpServletResponse servletResponse = null; 
  - 
  -    /** The ServletContext */ 
  -    private ServletContext servletContext = null; 
  - 
  -    /** The OutputStream */ 
  -    private OutputStream outputStream = null; 
  - 
       /**
  -     * Constructs a HttpEnvironment object from a HttpServletRequest 
  +     * Constructs a HttpEnvironment object from a HttpServletRequest
        * and HttpServletResponse objects
        */
  -    public HttpEnvironment (String uri, HttpServletRequest request, 
  -                            HttpServletResponse response, 
  -                            ServletContext servletContext) 
  +    public HttpEnvironment (String uri, HttpServletRequest request,
  +                            HttpServletResponse response,
  +                            ServletContext servletContext)
       throws MalformedURLException, IOException {
           super(uri, request.getParameter(Cocoon.VIEW_PARAM), servletContext.getRealPath("/"));
           this.request = new HttpRequest (request, this);
           this.servletRequest = request;
           this.response = new HttpResponse (response);
           this.servletResponse = response;
  -        this.servletContext = servletContext; 
  +        this.servletContext = servletContext;
           this.outputStream = response.getOutputStream();
           this.objectModel.put(Cocoon.REQUEST_OBJECT, this.request);
           this.objectModel.put(Cocoon.RESPONSE_OBJECT, this.response);
  @@ -66,30 +66,32 @@
        */
       public void redirect(String newURL) throws IOException {
           String qs = request.getQueryString();
  -        if (qs != null) {
  -            this.response.sendRedirect (newURL + "?" + qs);
  -        } else {
  -            this.response.sendRedirect (newURL);
  -        } 
  +        String redirect = newURL;
  +
  +        if (qs != null)
  +            redirect = redirect + "?" + qs;
  +
  +        log.debug("Sending redirect to '" + redirect + "'");
  +        this.response.sendRedirect (redirect);
       }
   
  -    /** 
  -     * Set the StatusCode 
  -     */ 
  -    public void setStatus(int statusCode) { 
  -        this.response.setStatus(statusCode); 
  -    } 
  -
  -    /** 
  -     * Set the ContentType 
  -     */ 
  -    public void setContentType(String contentType) { 
  -        this.response.setContentType(contentType); 
  -    } 
  - 
  -    /** 
  -     * Get the OutputStream 
  -     */ 
  +    /**
  +     * Set the StatusCode
  +     */
  +    public void setStatus(int statusCode) {
  +        this.response.setStatus(statusCode);
  +    }
  +
  +    /**
  +     * Set the ContentType
  +     */
  +    public void setContentType(String contentType) {
  +        this.response.setContentType(contentType);
  +    }
  +
  +    /**
  +     * Get the OutputStream
  +     */
       public OutputStream getOutputStream() throws IOException {
           return this.outputStream;
       }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.14  +18 -17    xml-cocoon/src/org/apache/cocoon/serialization/Attic/SVGSerializer.java
  
  Index: SVGSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/serialization/Attic/SVGSerializer.java,v
  retrieving revision 1.1.2.13
  retrieving revision 1.1.2.14
  diff -u -r1.1.2.13 -r1.1.2.14
  --- SVGSerializer.java	2000/11/10 22:38:54	1.1.2.13
  +++ SVGSerializer.java	2000/11/15 19:29:41	1.1.2.14
  @@ -3,9 +3,9 @@
    * ------------------------------------------------------------------------- *
    * This software is published under the terms of the Apache Software License *
    * version 1.1,  a copy of wich has been included  with this distribution in *
  - * the LICENSE file.                                                         * 
  - *****************************************************************************/ 
  - 
  + * the LICENSE file.                                                         *
  + *****************************************************************************/
  +
   package org.apache.cocoon.serialization;
   
   import org.apache.cocoon.*;
  @@ -25,7 +25,7 @@
   import org.csiro.svg.dom.SVGDocumentImpl;
   
   public class SVGSerializer extends DOMBuilder implements Composer, Serializer, Configurable {
  -   
  +
       /** The <code>ContentHandler</code> receiving SAX events. */
       private ContentHandler contentHandler=null;
       /** The <code>LexicalHandler</code> receiving SAX events. */
  @@ -54,36 +54,37 @@
           this.output=new BufferedOutputStream(out);
       }
   
  -    /** 
  -     * Set the configurations for this serializer. 
  +    /**
  +     * Set the configurations for this serializer.
        */
       public void configure(Configuration conf) throws ConfigurationException {
           this.config = conf;
   
           try {
  -	    log.debug("Looking up " + Roles.PARSER);
  +        log.debug("Looking up " + Roles.PARSER);
               // First, get a DOM parser for the DOM Builder to work with.
               super.factory= (Parser) this.manager.lookup(Roles.PARSER);
  -	} catch (Exception e) {
  -	    log.error("Could not find component", e);
  -	}
  +    } catch (Exception e) {
  +        log.error("Could not find component", e);
  +        throw new ConfigurationException("Could not find Parser", e);
  +    }
   
           // What image encoder do I use?
           String enc = this.config.getChild("encoder").getValue();
           if (enc == null) {
               throw new ConfigurationException("No Image Encoder specified.");
           }
  -        
  +
           try {
  -	    log.debug("Selecting " + Roles.IMAGE_ENCODER + ": " + enc);
  -	    ComponentSelector selector = (ComponentSelector) this.manager.lookup(Roles.IMAGE_ENCODER);
  +        log.debug("Selecting " + Roles.IMAGE_ENCODER + ": " + enc);
  +        ComponentSelector selector = (ComponentSelector) this.manager.lookup(Roles.IMAGE_ENCODER);
               this.encoder = (ImageEncoder) selector.select(enc);
           } catch (Exception e) {
  -	    log.error("Could not select " + Roles.IMAGE_ENCODER, e);
  -            throw new ConfigurationException("The ImageEncoder '" 
  +        log.error("Could not select " + Roles.IMAGE_ENCODER, e);
  +            throw new ConfigurationException("The ImageEncoder '"
                   + enc + "' cannot be found. Check your component configuration in the sitemap"/*, conf*/);
           }
  -        
  +
           // Configure the encoder
           if (this.encoder instanceof Configurable) {
               ((Configurable)this.encoder).configure(conf);
  @@ -174,7 +175,7 @@
               throw new SAXException("IOException writing image ", ex);
           }
       }
  -    
  +
       /**
        * Return the MIME type.
        */
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.30  +2 -2      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.29
  retrieving revision 1.1.4.30
  diff -u -r1.1.4.29 -r1.1.4.30
  --- CocoonServlet.java	2000/11/15 15:51:47	1.1.4.29
  +++ CocoonServlet.java	2000/11/15 19:29:41	1.1.4.30
  @@ -47,7 +47,7 @@
    *         (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
    * @author <a href="mailto:nicolaken@supereva.it">Nicola Ken Barozzi</a> Aisa
  - * @version CVS $Revision: 1.1.4.29 $ $Date: 2000/11/15 15:51:47 $
  + * @version CVS $Revision: 1.1.4.30 $ $Date: 2000/11/15 19:29:41 $
    */
   
   public class CocoonServlet extends HttpServlet {
  @@ -177,7 +177,7 @@
           }
   
           // We got it... Process the request
  -        String uri =  req.getServletPath();
  +        String uri = req.getServletPath();
           if (uri == null) uri = "";
           String pathInfo = req.getPathInfo();
           if (pathInfo != null) uri += pathInfo;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.14  +5 -1      xml-cocoon/src/org/apache/cocoon/sitemap/Attic/AbstractSitemap.java
  
  Index: AbstractSitemap.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/AbstractSitemap.java,v
  retrieving revision 1.1.2.13
  retrieving revision 1.1.2.14
  diff -u -r1.1.2.13 -r1.1.2.14
  --- AbstractSitemap.java	2000/10/30 18:39:17	1.1.2.13
  +++ AbstractSitemap.java	2000/11/15 19:29:42	1.1.2.14
  @@ -25,15 +25,19 @@
   import org.apache.cocoon.sitemap.ComponentHolderFactory;
   import org.apache.cocoon.util.ClassUtils;
   
  +import org.apache.log.LogKit;
  +import org.apache.log.Logger;
  +
   import org.xml.sax.SAXException;
   
   /**
    * Base class for generated <code>Sitemap</code> classes
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.13 $ $Date: 2000/10/30 18:39:17 $
  + * @version CVS $Revision: 1.1.2.14 $ $Date: 2000/11/15 19:29:42 $
    */
   public abstract class AbstractSitemap implements Sitemap {
  +    protected Logger log = LogKit.getLoggerFor("cocoon");
   
       /** The component manager instance */
       protected ComponentManager manager;