cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From un...@apache.org
Subject cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/pipeline AbstractProcessingPipeline.java
Date Fri, 06 Feb 2004 11:37:49 GMT
unico       2004/02/06 03:37:49

  Modified:    src/java/org/apache/cocoon/components/source/impl
                        SitemapSource.java
               src/java/org/apache/cocoon/components/pipeline
                        AbstractProcessingPipeline.java
  Log:
  fixing bug 25212: return the mimetype set in the environment by AbstractProcessingPipeline,
  ensuring internal requests are always text/xml in case of SAX pipeline
  
  Revision  Changes    Path
  1.17      +7 -2      cocoon-2.1/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java
  
  Index: SitemapSource.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- SitemapSource.java	4 Feb 2004 15:10:47 -0000	1.16
  +++ SitemapSource.java	6 Feb 2004 11:37:49 -0000	1.17
  @@ -146,6 +146,8 @@
       /** SourceResolver (for the redirect source) */
       private SourceResolver sourceResolver;
       
  +    private String mimeType;
  +    
       /**
        * Construct a new object
        */
  @@ -359,7 +361,7 @@
        * this can be null.
        */
        public String getMimeType() {
  -        return "text/xml";
  +         return this.mimeType;
        }
   
       /**
  @@ -391,6 +393,8 @@
                   try {
                       this.processingPipeline.prepareInternal(this.environment);
                       this.sourceValidity = this.processingPipeline.getValidityForEventPipeline();
  +                    this.mimeType = this.environment.getContentType();
  +                    
                       final String eventPipelineKey = this.processingPipeline.getKeyForEventPipeline();
                       if (eventPipelineKey != null) {
                           StringBuffer buffer = new StringBuffer(this.systemId);
  @@ -417,6 +421,7 @@
                   }
                   this.redirectSource = this.sourceResolver.resolveURI(redirectURL);
                   this.redirectValidity = this.redirectSource.getValidity();
  +                this.mimeType = this.redirectSource.getMimeType();
               }
           } catch (SAXException e) {
               reset();
  
  
  
  1.14      +21 -16    cocoon-2.1/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java
  
  Index: AbstractProcessingPipeline.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- AbstractProcessingPipeline.java	4 Feb 2004 15:14:59 -0000	1.13
  +++ AbstractProcessingPipeline.java	6 Feb 2004 11:37:49 -0000	1.14
  @@ -422,22 +422,27 @@
                       this.serializerParam
                   );
               }
  -
  -            String mimeType = this.serializer.getMimeType();
  -            if (mimeType != null) {
  -                // we have a mimeType from the component itself
  -                environment.setContentType (mimeType);
  -            } else if (serializerMimeType != null) {
  -                // there was a mimeType specified in the sitemap pipeline
  -                environment.setContentType (serializerMimeType);
  -            } else if (this.sitemapSerializerMimeType != null) {
  -                // use the mimeType specified in the sitemap component declaration
  -                environment.setContentType (this.sitemapSerializerMimeType);
  +            
  +            if (this.lastConsumer == null) {
  +                // internal processing: text/xml
  +                environment.setContentType("text/xml");
               } else {
  -                // No mimeType available
  -                String message = "Unable to determine MIME type for " +
  -                    environment.getURIPrefix() + "/" + environment.getURI();
  -                throw new ProcessingException(message);
  +                String mimeType = this.serializer.getMimeType();
  +                if (mimeType != null) {
  +                    // we have a mimeType from the component itself
  +                    environment.setContentType (mimeType);
  +                } else if (serializerMimeType != null) {
  +                    // there was a mimeType specified in the sitemap pipeline
  +                    environment.setContentType (serializerMimeType);
  +                } else if (this.sitemapSerializerMimeType != null) {
  +                    // use the mimeType specified in the sitemap component declaration
  +                    environment.setContentType (this.sitemapSerializerMimeType);
  +                } else {
  +                    // No mimeType available
  +                    String message = "Unable to determine MIME type for " +
  +                        environment.getURIPrefix() + "/" + environment.getURI();
  +                    throw new ProcessingException(message);
  +                }
               }
           } catch (SAXException e) {
               throw new ProcessingException(
  
  
  

Mime
View raw message