cziegeler    02/04/25 02:30:48

  Modified:    lib/core avalon-excalibur-20020424.jar
               src/java/org/apache/cocoon Cocoon.java cocoon.roles
               src/java/org/apache/cocoon/components/source/impl
                        AvalonToCocoonSource.java SitemapSource.java
               src/java/org/apache/cocoon/environment
                        AbstractEnvironment.java Environment.java
                        ForwardRedirector.java
               src/java/org/apache/cocoon/environment/wrapper
                        EnvironmentWrapper.java
               src/webapp/WEB-INF cocoon.xconf
  Log:
  Adding xmlizer and fixing some todos
  
  Revision  Changes    Path
  1.2       +416 -373  xml-cocoon2/lib/core/avalon-excalibur-20020424.jar
  
        <<Binary file>>
  
  
  1.24      +9 -3      xml-cocoon2/src/java/org/apache/cocoon/Cocoon.java
  
  Index: Cocoon.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/Cocoon.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- Cocoon.java       19 Apr 2002 11:02:57 -0000      1.23
  +++ Cocoon.java       25 Apr 2002 09:30:48 -0000      1.24
  @@ -99,7 +99,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Pierpaolo Fumagalli</a> (Apache 
Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stefano Mazzocchi</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Leo Sutic</a>
  - * @version CVS $Id: Cocoon.java,v 1.23 2002/04/19 11:02:57 cziegeler Exp $
  + * @version CVS $Id: Cocoon.java,v 1.24 2002/04/25 09:30:48 cziegeler Exp $
    */
   public class Cocoon
           extends AbstractLoggable
  @@ -149,6 +149,9 @@
       /** The Source Resolver */
       private org.apache.excalibur.source.SourceResolver sourceResolver;
   
  +    /** The XMLizer */
  +    private org.apache.excalibur.xmlizer.XMLizer xmlizer;
  +
       /**
        * Creates a new <code>Cocoon</code> instance.
        *
  @@ -288,6 +291,7 @@
           }
   
           this.sourceResolver = 
(org.apache.excalibur.source.SourceResolver)this.componentManager.lookup(org.apache.excalibur.source.SourceResolver.ROLE);
  +        this.xmlizer = 
(org.apache.excalibur.xmlizer.XMLizer)this.componentManager.lookup(org.apache.excalibur.xmlizer.XMLizer.ROLE);
       }
   
       /** Dump System Properties */
  @@ -450,7 +454,9 @@
       public void dispose() {
           this.componentManager.release(this.threadSafeProcessor);
           this.componentManager.release(this.sourceResolver);
  +        this.componentManager.release(this.xmlizer);
           this.sourceResolver = null;
  +        this.xmlizer = null;
           this.componentManager.dispose();
           if (this.configurationFile != null) {
               this.configurationFile.recycle();
  @@ -571,7 +577,7 @@
               throw new IllegalStateException("You cannot process a Disposed Cocoon 
engine.");
           }
   
  -        environment.setSourceResolver( this.sourceResolver );
  +        environment.setComponents( this.sourceResolver, this.xmlizer );
           try {
               if (this.getLogger().isDebugEnabled()) {
                   ++activeRequestCount;
  @@ -595,7 +601,7 @@
               if (this.getLogger().isDebugEnabled()) {
                   --activeRequestCount;
               }
  -            environment.setSourceResolver( null );
  +            environment.setComponents( null, null );
           }
       }
   
  
  
  
  1.23      +14 -9     xml-cocoon2/src/java/org/apache/cocoon/cocoon.roles
  
  Index: cocoon.roles
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/cocoon.roles,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- cocoon.roles      19 Apr 2002 11:03:29 -0000      1.22
  +++ cocoon.roles      25 Apr 2002 09:30:48 -0000      1.23
  @@ -103,14 +103,6 @@
       <hint shorthand="informix" 
class="org.apache.avalon.excalibur.datasource.InformixDataSource"/>
     </role>
   
  -  <role name="org.apache.cocoon.components.url.URLFactory"
  -        shorthand="url-factory"
  -        default-class="org.apache.cocoon.components.url.URLFactoryImpl"/>
  -
  -  <role name="org.apache.cocoon.components.source.SourceHandler"
  -        shorthand="source-handler"
  -        default-class="org.apache.cocoon.components.source.SourceHandlerImpl"/>
  -
     <role name="org.apache.excalibur.source.SourceFactorySelector"
           shorthand="source-factories"
           
default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector">
  @@ -120,6 +112,10 @@
           shorthand="source-resolver"
           default-class="org.apache.excalibur.source.impl.SourceResolverImpl"/>
   
  +  <role name="org.apache.excalibur.xmlizer.XMLizer"
  +        shorthand="xmlizer"
  +        default-class="org.apache.excalibur.xmlizer.impl.XMLizerImpl"/>
  +
     <role name="org.apache.cocoon.components.sax.XMLSerializer"
           shorthand="xml-serializer"
           default-class="org.apache.cocoon.components.sax.XMLByteStreamCompiler"/>
  @@ -212,7 +208,6 @@
           
default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector"/>
   
     <!-- DEPRECATED, use the xml-parser instead ! -->
  -
     <role name="org.apache.cocoon.components.resolver.Resolver"
           shorthand="resolver"
           default-class="org.apache.cocoon.components.resolver.ResolverImpl"/>
  @@ -220,5 +215,15 @@
     <role name="org.apache.cocoon.components.parser.Parser"
           shorthand="parser"
           default-class="org.apache.cocoon.components.parser.JaxpParser"/>
  +
  +  <!-- DEPRECATED, use the avalon excalibur source resolve instead -->
  +  <role name="org.apache.cocoon.components.url.URLFactory"
  +        shorthand="url-factory"
  +        default-class="org.apache.cocoon.components.url.URLFactoryImpl"/>
  +
  +  <role name="org.apache.cocoon.components.source.SourceHandler"
  +        shorthand="source-handler"
  +        default-class="org.apache.cocoon.components.source.SourceHandlerImpl"/>
  +
   
   </role-list>
  
  
  
  1.2       +27 -8     
xml-cocoon2/src/java/org/apache/cocoon/components/source/impl/AvalonToCocoonSource.java
  
  Index: AvalonToCocoonSource.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/impl/AvalonToCocoonSource.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AvalonToCocoonSource.java 24 Apr 2002 13:48:20 -0000      1.1
  +++ AvalonToCocoonSource.java 25 Apr 2002 09:30:48 -0000      1.2
  @@ -55,6 +55,7 @@
   import org.apache.avalon.excalibur.xml.XMLizable;
   import org.apache.excalibur.source.*;
   import org.apache.cocoon.ProcessingException;
  +import org.apache.cocoon.environment.Environment;
   import org.apache.cocoon.environment.ModifiableSource;
   import org.xml.sax.ContentHandler;
   import org.xml.sax.InputSource;
  @@ -66,7 +67,7 @@
    * resolve() method of the environment!
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2002/04/24 13:48:20 $
  + * @version CVS $Revision: 1.2 $ $Date: 2002/04/25 09:30:48 $
    */
   
   public final class AvalonToCocoonSource
  @@ -75,6 +76,23 @@
       /** The real source */
       protected Source source;
   
  +    /** The source resolver */
  +    protected SourceResolver resolver;
  +
  +    /** The environment */
  +    protected Environment environment;
  +
  +    /**
  +     * Constructor
  +     */
  +    public AvalonToCocoonSource(Source source,
  +                                SourceResolver resolver,
  +                                Environment environment) {
  +        this.source = source;
  +        this.resolver = resolver;
  +        this.environment = environment;
  +    }
  +
       /**
        * Get the last modification date of the source or 0 if it
        * is not possible to determine the date.
  @@ -100,8 +118,7 @@
       throws ProcessingException, IOException {
           try {
               return this.source.getInputStream();
  -            // FIXME (CZ) Change to SourceException
  -        } catch (Exception e) {
  +        } catch (SourceException e) {
               throw new ProcessingException(e);
           }
       }
  @@ -133,7 +150,9 @@
       }
   
       public void recycle() {
  -        // FIXME
  +        this.resolver.release(this.source);
  +        this.source = null;
  +        this.environment = null;
       }
   
       public void refresh() {
  @@ -149,10 +168,10 @@
        */
       public void toSAX(ContentHandler handler)
       throws SAXException, ProcessingException {
  -        if (this.source instanceof XMLizable) {
  -            ((XMLizable)this.source).toSAX( handler );
  -        } else {
  -            // FIXME
  +        try {
  +            this.environment.toSAX(this.source, handler);
  +        } catch (IOException ioe) {
  +            throw new ProcessingException("IOException during streaming.", ioe);
           }
       }
   
  
  
  
  1.3       +10 -5     
xml-cocoon2/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java
  
  Index: SitemapSource.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SitemapSource.java        24 Apr 2002 13:48:20 -0000      1.2
  +++ SitemapSource.java        25 Apr 2002 09:30:48 -0000      1.3
  @@ -95,7 +95,7 @@
    * Description of a source which is defined by a pipeline.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version CVS $Id: SitemapSource.java,v 1.2 2002/04/24 13:48:20 cziegeler Exp $
  + * @version CVS $Id: SitemapSource.java,v 1.3 2002/04/25 09:30:48 cziegeler Exp $
    */
   
   public final class SitemapSource
  @@ -132,6 +132,9 @@
       /** The redirect <code>Source</code> */
       private Source redirectSource;
   
  +    /** Redirect validity */
  +    private SourceValidity redirectValidity;
  +
       /** The <code>SAXException</code> if unable to get resource */
       private SAXException exception;
   
  @@ -276,6 +279,9 @@
           if (this.needsRefresh) {
               this.discardValidity();
           }
  +        if (this.redirectSource != null) {
  +            return this.redirectValidity;
  +        }
           if (this.lastModificationDate < 1) {
               return null;
           } else {
  @@ -332,8 +338,7 @@
                           redirectURL = "cocoon:/" + redirectURL;
                       }
                       this.redirectSource = this.environment.resolveURI(redirectURL);
  -                    // FIXME (CZ)
  -                    //this.lastModificationDate = 
this.redirectSource.getLastModified();
  +                    this.redirectValidity = this.redirectSource.getValidity();
                   }
           } catch (SAXException e) {
               reset();
  @@ -378,8 +383,7 @@
                   consumer = new ContentHandlerWrapper(contentHandler);
               }
               if (this.redirectSource != null) {
  -                // FIXME (CZ)
  -                // this.redirectSource.toSAX(consumer);
  +                this.environment.toSAX(this.redirectSource, consumer);
               } else {
                   try {
                       CocoonComponentManager.enterEnvironment(this.environment,
  @@ -413,6 +417,7 @@
           if (this.redirectSource != null) 
this.environment.release(this.redirectSource);
           this.environment.reset();
           this.redirectSource = null;
  +        this.redirectValidity = null;
           this.exception = null;
           this.needsRefresh = true;
       }
  
  
  
  1.16      +45 -4     
xml-cocoon2/src/java/org/apache/cocoon/environment/AbstractEnvironment.java
  
  Index: AbstractEnvironment.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/AbstractEnvironment.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- AbstractEnvironment.java  24 Apr 2002 13:48:20 -0000      1.15
  +++ AbstractEnvironment.java  25 Apr 2002 09:30:48 -0000      1.16
  @@ -50,12 +50,14 @@
   */
   package org.apache.cocoon.environment;
   
  -import org.apache.excalibur.source.SourceException;
   import org.apache.avalon.excalibur.collections.IteratorEnumeration;
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.logger.AbstractLoggable;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.components.source.SourceHandler;
  +import org.apache.excalibur.source.SourceException;
  +import org.apache.excalibur.xmlizer.XMLizer;
  +import org.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
   
   import java.io.File;
  @@ -71,7 +73,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Giacomo Pati</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version CVS $Id: AbstractEnvironment.java,v 1.15 2002/04/24 13:48:20 cziegeler 
Exp $
  + * @version CVS $Id: AbstractEnvironment.java,v 1.16 2002/04/25 09:30:48 cziegeler 
Exp $
    */
   public abstract class AbstractEnvironment extends AbstractLoggable implements 
Environment {
   
  @@ -102,6 +104,9 @@
       /** The real source resolver */
       protected org.apache.excalibur.source.SourceResolver sourceResolver;
   
  +    /** The real xmlizer */
  +    protected org.apache.excalibur.xmlizer.XMLizer xmlizer;
  +
       /** The attributes */
       private Map attributes = new HashMap();
   
  @@ -165,12 +170,21 @@
       }
   
       /**
  -     * Set the <code>SourceResolver</code>
  +     * Set the <code>SourceResolver</code> and the <code>XMLizer</code>
        */
  -    public void setSourceResolver(org.apache.excalibur.source.SourceResolver 
resolver) {
  +    public void setComponents(org.apache.excalibur.source.SourceResolver resolver,
  +                              XMLizer xmlizer) {
  +        this.xmlizer = xmlizer;
           this.sourceResolver = resolver;
       }
   
  +    /**
  +     * Get the <code>SourceResolver</code>
  +     */
  +    public org.apache.excalibur.source.SourceResolver getSourceResolver() {
  +        return this.sourceResolver;
  +    }
  +
       // Sitemap methods
   
       /**
  @@ -440,6 +454,33 @@
        */
       public void release( final org.apache.excalibur.source.Source source ) {
           this.sourceResolver.release( source );
  +    }
  +
  +    /**
  +     * Generates SAX events from the given source
  +     * <b>NOTE</b> : if the implementation can produce lexical events, care should 
be taken
  +     * that <code>handler</code> can actually
  +     * directly implement the LexicalHandler interface!
  +     * @param  source    the data
  +     * @throws ProcessingException if no suitable converter is found
  +     */
  +    public void toSAX( org.apache.excalibur.source.Source source,
  +                       ContentHandler handler )
  +    throws SAXException, IOException, ProcessingException {
  +        if ( source instanceof org.apache.avalon.excalibur.xml.XMLizable ) {
  +            ((org.apache.avalon.excalibur.xml.XMLizable)source).toSAX( handler );
  +        } else {
  +            try {
  +                xmlizer.toSAX( source.getInputStream(),
  +                               source.getMimeType(),
  +                               source.getSystemId(),
  +                               handler );
  +            } catch (SourceException se) {
  +                throw new ProcessingException("Exception during streaming source.", 
se);
  +            } catch (ComponentException ce) {
  +                throw new ProcessingException("Exception during streaming source.", 
ce);
  +            }
  +        }
       }
   
   }
  
  
  
  1.8       +26 -5     
xml-cocoon2/src/java/org/apache/cocoon/environment/Environment.java
  
  Index: Environment.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/Environment.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Environment.java  19 Apr 2002 11:02:57 -0000      1.7
  +++ Environment.java  25 Apr 2002 09:30:48 -0000      1.8
  @@ -50,23 +50,27 @@
   */
   package org.apache.cocoon.environment;
   
  +import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.components.source.SourceHandler;
  -
  +import org.apache.excalibur.xmlizer.XMLizer;
   import java.io.IOException;
   import java.io.OutputStream;
   import java.net.URL;
   import java.util.Enumeration;
   import java.util.Map;
  +import org.xml.sax.ContentHandler;
  +import org.xml.sax.SAXException;
   
   /**
    * Base interface for an environment abstraction
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Giacomo Pati</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version CVS $Id: Environment.java,v 1.7 2002/04/19 11:02:57 cziegeler Exp $
  + * @version CVS $Id: Environment.java,v 1.8 2002/04/25 09:30:48 cziegeler Exp $
    */
   
  -public interface Environment extends SourceResolver {
  +public interface Environment
  +    extends SourceResolver {
   
       /**
        * Get the <code>SourceHandler</code> for the current request
  @@ -79,9 +83,15 @@
       void setSourceHandler(SourceHandler sourceHandler);
   
       /**
  -     * Set the <code>SourceResolver</code>
  +     * Set the <code>SourceResolver</code> and the <code>XMLizer</code>
        */
  -    void setSourceResolver(org.apache.excalibur.source.SourceResolver resolver);
  +    void setComponents(org.apache.excalibur.source.SourceResolver resolver,
  +                       XMLizer xmlizer);
  +
  +    /**
  +     * Get the <code>SourceResolver</code>
  +     */
  +    org.apache.excalibur.source.SourceResolver getSourceResolver();
   
       /**
        * Get the URI to process. The prefix is stripped off.
  @@ -222,5 +232,16 @@
       */
       boolean tryResetResponse();
   
  +    /**
  +     * Generates SAX events from the given source
  +     * <b>NOTE</b> : if the implementation can produce lexical events, care should 
be taken
  +     * that <code>handler</code> can actually
  +     * directly implement the LexicalHandler interface!
  +     * @param  source    the data
  +     * @throws ProcessingException if no suitable converter is found
  +     */
  +    void toSAX( org.apache.excalibur.source.Source source,
  +                ContentHandler handler )
  +    throws SAXException, IOException, ProcessingException;
   }
   
  
  
  
  1.2       +33 -32    
xml-cocoon2/src/java/org/apache/cocoon/environment/ForwardRedirector.java
  
  Index: ForwardRedirector.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/ForwardRedirector.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ForwardRedirector.java    28 Mar 2002 08:45:10 -0000      1.1
  +++ ForwardRedirector.java    25 Apr 2002 09:30:48 -0000      1.2
  @@ -70,27 +70,27 @@
    * redirects using the "cocoon:" pseudo-protocol.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Sylvain Wallez</a>
  - * @version CVS $Id: ForwardRedirector.java,v 1.1 2002/03/28 08:45:10 sylvain Exp $
  + * @version CVS $Id: ForwardRedirector.java,v 1.2 2002/04/25 09:30:48 cziegeler Exp 
$
    */
   public class ForwardRedirector extends AbstractLoggable implements Redirector {
  -    
  +
       /** Was there a call to <code>redirect()</code> ? */
       private boolean hasRedirected = false;
  -    
  +
       /** The <code>Environment to use for redirection (either internal or external) 
*/
       private Environment env;
  -    
  +
       /** The <code>Processor</code> that owns this redirector and which will be used
           to handle relative "cocoon:/..." redirects */
       private Processor processor;
  -    
  +
       /** The component manager which gives access to the top-level 
<code>Processor</code>
           to handle absolute "cocoon://..." redirects */
       private ComponentManager manager;
  -    
  +
       /** The stream pipeline (can be null) used for internal redirects */
       private StreamPipeline streamPipe;
  -    
  +
       /** The event pipeline (can be null) used for internal redirects */
       private EventPipeline eventPipe;
   
  @@ -109,11 +109,11 @@
        * environment.
        */
       public void redirect(boolean sessionMode, String url) throws IOException, 
ProcessingException {
  -        
  +
           if (getLogger().isInfoEnabled()) {
               getLogger().info("Redirecting to '" + url + "'");
           }
  -        
  +
           if (url.startsWith("cocoon:")) {
               cocoonRedirect(sessionMode, url);
           } else {
  @@ -127,11 +127,11 @@
        * subpipeline.
        */
       public void globalRedirect(boolean sessionMode, String url) throws IOException, 
ProcessingException {
  -        
  +
           if (getLogger().isInfoEnabled()) {
               getLogger().info("Redirecting to '" + url + "'");
           }
  -        
  +
           // FIXME : how to handle global redirect to cocoon: ?
           if (url.startsWith("cocoon:")) {
               cocoonRedirect(sessionMode, url);
  @@ -145,12 +145,13 @@
           }
           this.hasRedirected = true;
       }
  -    
  -    private void cocoonRedirect(boolean sessionMode, String uri) throws 
IOException, ProcessingException {
  -    try {
  +
  +    private void cocoonRedirect(boolean sessionMode, String uri)
  +    throws IOException, ProcessingException {
  +        try {
               boolean rawMode = false;
               String prefix;
  -    
  +
               // remove the protocol
               int protocolEnd = uri.indexOf(':');
               if (protocolEnd != -1) {
  @@ -161,9 +162,9 @@
                       rawMode = true;
                   }
               }
  -    
  +
               Processor actualProcessor;
  -            
  +
               // Does the uri point to this sitemap or to the root sitemap?
               if (uri.startsWith("//")) {
                   uri = uri.substring(2);
  @@ -173,16 +174,16 @@
                   } catch (ComponentException e) {
                       throw new ProcessingException("Cannot get Processor instance", 
e);
                   }
  -    
  +
               } else if (uri.startsWith("/")) {
                   prefix = null; // means use current prefix
                   uri = uri.substring(1);
                   actualProcessor = this.processor;
  -    
  +
               } else {
                   throw new ProcessingException("Malformed cocoon URI.");
               }
  -    
  +
               // create the queryString (if available)
               String queryString = null;
               int queryStringPos = uri.indexOf('?');
  @@ -190,26 +191,26 @@
                   queryString = uri.substring(queryStringPos + 1);
                   uri = uri.substring(0, queryStringPos);
               }
  -    
  +
               // build the request uri which is relative to the context
               String requestURI = (prefix == null ? env.getURIPrefix() + uri : uri);
  -    
  +
               ForwardEnvironmentWrapper newEnv =
                   new ForwardEnvironmentWrapper(env, requestURI, queryString, 
getLogger(), rawMode);
               newEnv.setURI(prefix, uri);
  -    
  +
               boolean processingResult;
  -            
  +
               if (this.eventPipe == null && this.streamPipe == null) {
                   processingResult = actualProcessor.process(newEnv);
               } else {
                   processingResult = actualProcessor.process(newEnv, this.streamPipe, 
this.eventPipe);
               }
  -            
  +
               if (!processingResult) {
                   throw new ProcessingException("Couldn't process URI " + requestURI);
               }
  -            
  +
           } catch(IOException ioe) {
               throw ioe;
           } catch(ProcessingException pe) {
  @@ -227,13 +228,13 @@
       public boolean hasRedirected() {
           return this.hasRedirected;
       }
  -    
  +
       /**
        * Local extension of EnvironmentWrapper to propagate otherwise blocked
        * methods to the actual environment.
        */
       private class ForwardEnvironmentWrapper extends EnvironmentWrapper {
  -        
  +
           public ForwardEnvironmentWrapper(Environment env,
                                 String      requestURI,
                                 String      queryString,
  @@ -241,19 +242,19 @@
                                 boolean     rawMode) throws MalformedURLException {
               super(env, requestURI, queryString, logger, rawMode);
           }
  -        
  +
           public void setStatus(int statusCode) {
               environment.setStatus(statusCode);
           }
  -    
  +
           public void setContentLength(int length) {
               environment.setContentLength(length);
           }
  -    
  +
           public void setContentType(String contentType) {
               environment.setContentType(contentType);
           }
  -    
  +
           public String getContentType() {
               return environment.getContentType();
           }
  
  
  
  1.13      +19 -2     
xml-cocoon2/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java
  
  Index: EnvironmentWrapper.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- EnvironmentWrapper.java   21 Apr 2002 17:36:28 -0000      1.12
  +++ EnvironmentWrapper.java   25 Apr 2002 09:30:48 -0000      1.13
  @@ -50,12 +50,14 @@
   */
   package org.apache.cocoon.environment.wrapper;
   
  +import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.environment.AbstractEnvironment;
   import org.apache.cocoon.environment.Environment;
   import org.apache.cocoon.environment.ObjectModelHelper;
   import org.apache.cocoon.environment.Request;
   import org.apache.log.Logger;
  -
  +import org.xml.sax.ContentHandler;
  +import org.xml.sax.SAXException;
   import java.io.IOException;
   import java.io.OutputStream;
   import java.net.MalformedURLException;
  @@ -71,7 +73,7 @@
    * contains a <code>RequestWrapper</code> object.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version $Id: EnvironmentWrapper.java,v 1.12 2002/04/21 17:36:28 vgritsenko Exp $
  + * @version $Id: EnvironmentWrapper.java,v 1.13 2002/04/25 09:30:48 cziegeler Exp $
    */
   public class EnvironmentWrapper extends AbstractEnvironment implements Environment {
   
  @@ -109,6 +111,7 @@
                                 Logger      logger)
       throws MalformedURLException {
           this(env, requestURI, queryString, logger, false);
  +        this.setComponents(env.getSourceResolver(), null);
       }
   
       /**
  @@ -301,5 +304,19 @@
       {
           super.removeAttribute(name);
           environment.removeAttribute(name);
  +    }
  +
  +    /**
  +     * Generates SAX events from the given source
  +     * <b>NOTE</b> : if the implementation can produce lexical events, care should 
be taken
  +     * that <code>handler</code> can actually
  +     * directly implement the LexicalHandler interface!
  +     * @param  source    the data
  +     * @throws ProcessingException if no suitable converter is found
  +     */
  +    public void toSAX( org.apache.excalibur.source.Source source,
  +                       ContentHandler handler )
  +    throws SAXException, IOException, ProcessingException {
  +        this.environment.toSAX( source, handler );
       }
   }
  
  
  
  1.10      +5 -0      xml-cocoon2/src/webapp/WEB-INF/cocoon.xconf
  
  Index: cocoon.xconf
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/WEB-INF/cocoon.xconf,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- cocoon.xconf      24 Apr 2002 09:59:49 -0000      1.9
  +++ cocoon.xconf      25 Apr 2002 09:30:48 -0000      1.10
  @@ -180,6 +180,11 @@
         <component-instance 
class="org.apache.cocoon.components.source.impl.CocoonSourceFactory" name="cocoon"/>
     </source-factories>
   
  +  <!-- The XMLizer converts different mime-types to XML -->
  +  <xmlizer>
  +      <component-instance class="org.apache.excalibur.xmlizer.impl.TextXMLizer" 
name="text/xml"/>
  +      <component-instance class="org.apache.excalibur.xmlizer.impl.HTMLXMLizer" 
name="text/html"/>
  +  </xmlizer>
   
     <!-- Program Generator:
       The ProgamGenerator builds programs from a XML document written in a
  
  
  

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