cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/components/pipeline CachingStreamPipeline.java
Date Tue, 08 May 2001 16:32:45 GMT
dims        01/05/08 09:32:44

  Modified:    src/org/apache/cocoon/components/pipeline Tag: xml-cocoon2
                        CachingStreamPipeline.java
  Log:
  Added a few more setContentLength's. Even after this set of changes, if any
  of the components don't support caching, then content length is not set.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.12  +21 -11    xml-cocoon/src/org/apache/cocoon/components/pipeline/Attic/CachingStreamPipeline.java
  
  Index: CachingStreamPipeline.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/pipeline/Attic/CachingStreamPipeline.java,v
  retrieving revision 1.1.2.11
  retrieving revision 1.1.2.12
  diff -u -r1.1.2.11 -r1.1.2.12
  --- CachingStreamPipeline.java	2001/05/04 00:31:26	1.1.2.11
  +++ CachingStreamPipeline.java	2001/05/08 16:32:32	1.1.2.12
  @@ -44,9 +44,9 @@
    *  </ul>
    *
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1.2.11 $ $Date: 2001/05/04 00:31:26 $
  + * @version CVS $Revision: 1.1.2.12 $ $Date: 2001/05/08 16:32:32 $
    */
  -public final class CachingStreamPipeline extends AbstractStreamPipeline {
  +public class CachingStreamPipeline extends AbstractStreamPipeline {
   
       /** The role name of the serializer */
       private String serializerRole;
  @@ -176,13 +176,15 @@
                       if (valid == true) {
                           getLogger().debug("Using valid cached content for '" + environment.getURI()
+ "'.");
   
  -                        usedCache = true;
                           byte[] response = cachedObject.getResponse();
  -                        outputStream.write(response);
  -                        if (response.length != 0) {
  +                        if(response.length > 0) {
  +                            usedCache = true;
                               environment.setContentLength(response.length);
  +                            outputStream.write(response);
                           }
  -                    } else {
  +                    } 
  +                    
  +                    if(usedCache == false) {
                           getLogger().debug("Cached content is invalid for '" + environment.getURI()
+ "'.");
   
                           // remove invalid cached object
  @@ -293,9 +295,15 @@
                           if (valid == true) {
   
                               getLogger().debug("Using valid cached content for '" + environment.getURI()
+ "'.");
  -                            usedCache = true;
  -                            outputStream.write(cachedObject.getResponse());
  -                        } else {
  +                            byte[] bytes = cachedObject.getResponse();
  +                            if(bytes.length > 0) {
  +                                usedCache = true;
  +                                environment.setContentLength(bytes.length);
  +                                outputStream.write(bytes);
  +                            }
  +                        } 
  +                        
  +                        if (usedCache == false) {
   
                               getLogger().debug("Cached content is invalid for '" + environment.getURI()
+ "'.");
   
  @@ -320,9 +328,11 @@
   
                       // store the response
                       if (pcKey != null) {
  +                        byte[] bytes = ((CachingOutputStream)outputStream).getContent();
  +                        environment.setContentLength(bytes.length);
  +                        
                           this.streamCache.store(pcKey,
  -                            new CachedStreamObject(validityObjects,
  -                                  ((CachingOutputStream)outputStream).getContent()));
  +                            new CachedStreamObject(validityObjects, bytes));
                       }
                   }
   
  
  
  

----------------------------------------------------------------------
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