cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sylv...@apache.org
Subject cvs commit: xml-cocoon2/src/org/apache/cocoon/sitemap AbstractSitemap.java
Date Wed, 18 Jul 2001 12:46:10 GMT
sylvain     01/07/18 05:46:10

  Modified:    .        Tag: cocoon_20_branch changes.xml
               src/org/apache/cocoon/components/language/markup/sitemap/java
                        Tag: cocoon_20_branch sitemap.xsl
               src/org/apache/cocoon/sitemap Tag: cocoon_20_branch
                        AbstractSitemap.java
  Log:
  In http environment, try to reset the response prior to executing the handle-errors pipeline.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.19  +6 -1      xml-cocoon2/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/changes.xml,v
  retrieving revision 1.2.2.18
  retrieving revision 1.2.2.19
  diff -u -r1.2.2.18 -r1.2.2.19
  --- changes.xml	2001/07/12 13:33:41	1.2.2.18
  +++ changes.xml	2001/07/18 12:46:09	1.2.2.19
  @@ -4,7 +4,7 @@
   
   <!--
     History of Cocoon changes
  -  $Id: changes.xml,v 1.2.2.18 2001/07/12 13:33:41 cziegeler Exp $
  +  $Id: changes.xml,v 1.2.2.19 2001/07/18 12:46:09 sylvain Exp $
   -->
   
   <changes title="History of Changes">
  @@ -21,10 +21,15 @@
     <person name="Ricardo Rocha" email="ricardo@apache.org" id="RR"/>
     <person name="Paul Russell" email="prussell@apache.org" id="PR"/>
     <person name="Davanum Srinivas" email="dims@yahoo.com" id="DM"/>
  +  <person name="Sylvain Wallez" email="sylvain@apache.org" id="SW"/>
     <person name="Carsten Ziegeler" email="cziegeler@apache.org" id="CZ"/>
    </devs>
   
    <release version="2.0b1-dev" date="@date@">
  +  <action dev="SW" type="add">
  +    In http environment, reset the response if it hasn't been committed
  +    before executing the handle-errors pipeline.
  +  </action>
     <action dev="CZ" type="add">
       Added reloading of jar files. When cocoon is reloaded by specifying
       cocoon-reload parameter, the class-path is new build and used.
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.11.2.20 +2 -1      xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl
  
  Index: sitemap.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl,v
  retrieving revision 1.11.2.19
  retrieving revision 1.11.2.20
  diff -u -r1.11.2.19 -r1.11.2.20
  --- sitemap.xsl	2001/07/12 18:33:43	1.11.2.19
  +++ sitemap.xsl	2001/07/18 12:46:09	1.11.2.20
  @@ -127,7 +127,7 @@
        *
        * @author &lt;a href="mailto:giacomo@apache.org"&gt;Giacomo Pati&lt;/a&gt;
        * @author &lt;a href="mailto:bloritsch@apache.org"&gt;Berin Loritsch&lt;/a&gt;
  -     * @version CVS $Id: sitemap.xsl,v 1.11.2.19 2001/07/12 18:33:43 bloritsch Exp $
  +     * @version CVS $Id: sitemap.xsl,v 1.11.2.20 2001/07/18 12:46:09 sylvain Exp $
        */
       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"/>";
  @@ -516,6 +516,7 @@
               EventPipeline eventPipeline = null;
               StreamPipeline pipeline = null;
               try {
  +              tryResetResponse(objectModel);
                 eventPipeline = (EventPipeline)this.manager.lookup(EventPipeline.ROLE);
                 pipeline = (StreamPipeline)this.manager.lookup(StreamPipeline.ROLE);
                 pipeline.setEventPipeline(eventPipeline);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.17  +33 -1     xml-cocoon2/src/org/apache/cocoon/sitemap/AbstractSitemap.java
  
  Index: AbstractSitemap.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/AbstractSitemap.java,v
  retrieving revision 1.4.2.16
  retrieving revision 1.4.2.17
  diff -u -r1.4.2.16 -r1.4.2.17
  --- AbstractSitemap.java	2001/07/07 19:08:28	1.4.2.16
  +++ AbstractSitemap.java	2001/07/18 12:46:10	1.4.2.17
  @@ -28,12 +28,14 @@
   import org.apache.avalon.framework.context.Contextualizable;
   import org.apache.avalon.framework.logger.AbstractLoggable;
   import org.apache.avalon.framework.thread.ThreadSafe;
  +import org.apache.cocoon.Constants;
   import org.apache.cocoon.acting.Action;
   import org.apache.cocoon.components.classloader.RepositoryClassLoader;
   import org.apache.cocoon.components.pipeline.EventPipeline;
   import org.apache.cocoon.components.pipeline.StreamPipeline;
   import org.apache.cocoon.components.url.URLFactory;
   import org.apache.cocoon.environment.Environment;
  +import org.apache.cocoon.environment.http.HttpResponse;
   import org.apache.cocoon.generation.Generator;
   import org.apache.cocoon.matching.Matcher;
   import org.apache.cocoon.reading.Reader;
  @@ -49,7 +51,7 @@
    * Base class for generated <code>Sitemap</code> classes
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.4.2.16 $ $Date: 2001/07/07 19:08:28 $
  + * @version CVS $Revision: 1.4.2.17 $ $Date: 2001/07/18 12:46:10 $
    */
   public abstract class AbstractSitemap extends AbstractLoggable implements Sitemap, Disposable,
ThreadSafe {
       private Context context;
  @@ -380,5 +382,35 @@
           if (this.selectors != null) {
               manager.release((Component)this.selectors);
           }
  +    }
  +    
  +    /**
  +      Reset the response if possible. This allows error handlers to have
  +      a higher chance to produce clean output if the pipeline that raised
  +      the error has already output some data.
  +      
  +      @param objectModel the object model
  +      @return true if the response was successfully reset
  +      */
  +    
  +    protected boolean tryResetResponse(Map objectModel)
  +    {
  +        try {
  +            Object responseObj = objectModel.get(Constants.RESPONSE_OBJECT);
  +            if (responseObj instanceof HttpResponse) {
  +                HttpResponse response = (HttpResponse)responseObj;
  +                if (! response.isCommitted()) {
  +                    response.reset();
  +                    getLogger().debug("Response successfully reset");
  +                    return true;
  +                }
  +            }
  +        } catch(Exception e) {
  +            // Log the error, but don't transmit it
  +            getLogger().warn("Problem resetting response", e);
  +        }
  +        
  +        getLogger().debug("Response wasn't reset");
  +        return false;
       }
   }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message