You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2003/11/07 09:54:44 UTC

cvs commit: cocoon-2.2/src/java/org/apache/cocoon/components/pipeline AbstractProcessingPipeline.java

cziegeler    2003/11/07 00:54:44

  Modified:    src/java/org/apache/cocoon/components/pipeline
                        AbstractProcessingPipeline.java
  Log:
  Change the behaviour of the mime type setting for a reader
  See #10277
  
  Revision  Changes    Path
  1.16      +19 -8     cocoon-2.2/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java
  
  Index: AbstractProcessingPipeline.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- AbstractProcessingPipeline.java	5 Nov 2003 21:29:08 -0000	1.15
  +++ AbstractProcessingPipeline.java	7 Nov 2003 08:54:44 -0000	1.16
  @@ -578,15 +578,26 @@
       protected void setupReader(Environment environment)
       throws ProcessingException {
           try {
  -            String mimeType;
               this.reader.setup(this.processor.getEnvironmentHelper(),environment.getObjectModel(),readerSource,readerParam);
  -            mimeType = this.reader.getMimeType();
  -            if ( mimeType != null ) {
  -                environment.setContentType(mimeType);
  -            } else if ( readerMimeType != null ) {
  -                environment.setContentType(this.readerMimeType);
  +            // Set the mime-type
  +            // the behaviour has changed from 2.1.x to 2.2 according to bug #10277:
  +            // MIME type declared on the reader instance
  +            // MIME type declared for the reader component
  +            // Ask the Reader for a MIME type:
  +            //     A *.doc reader could peek into the file
  +            //     and return either text/plain or application/vnd.msword or
  +            //     the reader can use MIME type declared in WEB-INF/web.xml or 
  +            //     by the server.
  +
  +            if ( this.readerMimeType != null ) {
  +                environment.setContentType(this.readerMimeType);                
  +            } else if ( this.sitemapReaderMimeType != null ) {
  +                environment.setContentType(this.sitemapReaderMimeType);                
               } else {
  -                environment.setContentType(this.sitemapReaderMimeType);
  +                String mimeType = this.reader.getMimeType();
  +                if ( mimeType != null ) {
  +                    environment.setContentType(mimeType);                    
  +                }
               }
           } catch (SAXException e){
               throw new ProcessingException("Failed to execute reader pipeline.", e);