cziegeler    2002/08/13 05:49:22

  Modified:    src/java/org/apache/cocoon/components/pipeline/impl
                        AbstractCachingProcessingPipeline.java
               src/java/org/apache/cocoon/components/pipeline
                        AbstractProcessingPipeline.java
  Log:
  Don't give the serializer the output stream if the pipeline is processed internal - 
this should fix the recent authentication and portal login problems.
  
  Revision  Changes    Path
  1.5       +25 -17    
xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java
  
  Index: AbstractCachingProcessingPipeline.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractCachingProcessingPipeline.java    13 Aug 2002 09:58:30 -0000      1.4
  +++ AbstractCachingProcessingPipeline.java    13 Aug 2002 12:49:22 -0000      1.5
  @@ -231,31 +231,39 @@
                   if ( this.cacheCompleteResponse ) {
                       os = new CachingOutputStream( os );
                   }
  -                if (this.serializer.shouldSetContentLength()) {
  -                    // set the output stream
  -                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
  -                    this.serializer.setOutputStream(baos);
  -
  -                    // execute the pipeline:
  +                if ( super.serializer != super.lastConsumer ) {
  +                    // internal processing
                       if ( this.xmlDeserializer != null ) {
                           this.xmlDeserializer.deserialize(this.cachedResponse);
                       } else {
                           this.generator.generate();
                       }
  -                    byte[] data = baos.toByteArray();
  -                    environment.setContentLength(data.length);
  -                    os.write(data);
                   } else {
  -                    // set the output stream
  -                    this.serializer.setOutputStream( os );
  -                    // execute the pipeline:
  -                    if ( this.xmlDeserializer != null ) {
  -                        this.xmlDeserializer.deserialize(this.cachedResponse);
  +                    if (this.serializer.shouldSetContentLength()) {
  +                        // set the output stream
  +                        ByteArrayOutputStream baos = new ByteArrayOutputStream();
  +                        this.serializer.setOutputStream(baos);
  +    
  +                        // execute the pipeline:
  +                        if ( this.xmlDeserializer != null ) {
  +                            this.xmlDeserializer.deserialize(this.cachedResponse);
  +                        } else {
  +                            this.generator.generate();
  +                        }
  +                        byte[] data = baos.toByteArray();
  +                        environment.setContentLength(data.length);
  +                        os.write(data);
                       } else {
  -                        this.generator.generate();
  +                        // set the output stream
  +                        this.serializer.setOutputStream( os );
  +                        // execute the pipeline:
  +                        if ( this.xmlDeserializer != null ) {
  +                            this.xmlDeserializer.deserialize(this.cachedResponse);
  +                        } else {
  +                            this.generator.generate();
  +                        }
                       }
                   }
  -
                   //
                   // Now that we have processed the pipeline,
                   // we do the actual caching
  
  
  
  1.20      +19 -14    
xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java
  
  Index: AbstractProcessingPipeline.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- AbstractProcessingPipeline.java   9 Aug 2002 07:47:16 -0000       1.19
  +++ AbstractProcessingPipeline.java   13 Aug 2002 12:49:22 -0000      1.20
  @@ -485,21 +485,26 @@
       throws ProcessingException {
   
           try {
  -            if (this.serializer.shouldSetContentLength()) {
  -                // set the output stream
  -                ByteArrayOutputStream os = new ByteArrayOutputStream();
  -                this.serializer.setOutputStream(os);
  -
  -                // execute the pipeline:
  +            if ( this.serializer != this.lastConsumer ) {
  +                // internal processing
                   this.generator.generate();
  -                byte[] data = os.toByteArray();
  -                environment.setContentLength(data.length);
  -                environment.getOutputStream().write(data);
               } else {
  -                // set the output stream
  -                this.serializer.setOutputStream(environment.getOutputStream());
  -                // execute the pipeline:
  -                this.generator.generate();
  +                if (this.serializer.shouldSetContentLength()) {
  +                    // set the output stream
  +                    ByteArrayOutputStream os = new ByteArrayOutputStream();
  +                    this.serializer.setOutputStream(os);
  +    
  +                    // execute the pipeline:
  +                    this.generator.generate();
  +                    byte[] data = os.toByteArray();
  +                    environment.setContentLength(data.length);
  +                    environment.getOutputStream().write(data);
  +                } else {
  +                    // set the output stream
  +                    this.serializer.setOutputStream(environment.getOutputStream());
  +                    // execute the pipeline:
  +                    this.generator.generate();
  +                }
               }
           } catch ( ProcessingException e ) {
               throw e;
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to