giacomo     01/02/14 10:20:17

  Modified:    webapp   Tag: xml-cocoon2 sitemap.xmap
               src/org/apache/cocoon/transformation Tag: xml-cocoon2
                        TraxTransformer.java
               src/org/apache/cocoon/servlet Tag: xml-cocoon2
                        CocoonServlet.java
  Log:
  Patches from Carsten Ziegeler applied.
  
  - It addes an own method for the creating of the Environment.
    So changing the real class for the environment used is very easy.
  
  - It simply renames the use-cache parameter to use-store.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.40  +1 -1      xml-cocoon/webapp/Attic/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/webapp/Attic/sitemap.xmap,v
  retrieving revision 1.1.2.39
  retrieving revision 1.1.2.40
  diff -u -r1.1.2.39 -r1.1.2.40
  --- sitemap.xmap      2001/02/11 22:39:07     1.1.2.39
  +++ sitemap.xmap      2001/02/14 18:20:07     1.1.2.40
  @@ -18,7 +18,7 @@
     <map:transformers default="xslt">
      <map:transformer     name="xslt"      
src="org.apache.cocoon.transformation.TraxTransformer">
       <compile-stylesheets map:value="true"/>
  -    <use-cache map:value="false"/>
  +    <use-store map:value="false"/>
      </map:transformer>
      <map:transformer     name="log"       
src="org.apache.cocoon.transformation.LogTransformer"/>
      <map:transformer     name="sql"       
src="org.apache.cocoon.transformation.SQLTransformer"/>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.4   +12 -12    
xml-cocoon/src/org/apache/cocoon/transformation/Attic/TraxTransformer.java
  
  Index: TraxTransformer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/TraxTransformer.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- TraxTransformer.java      2001/02/12 13:30:46     1.1.2.3
  +++ TraxTransformer.java      2001/02/14 18:20:11     1.1.2.4
  @@ -58,7 +58,7 @@
    *         (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1.2.3 $ $Date: 2001/02/12 13:30:46 $
  + * @version CVS $Revision: 1.1.2.4 $ $Date: 2001/02/14 18:20:11 $
    */
   public class TraxTransformer extends ContentHandlerWrapper
   implements Transformer, Composer, Poolable, Recyclable, Configurable {
  @@ -73,8 +73,8 @@
       /** The trax TransformerHandler */
       private TransformerHandler transformerHandler = null;
   
  -    /** Is the cache turned on? (default is on) */
  -    private boolean useCache = true;
  +    /** Is the store turned on? (default is on) */
  +    private boolean useStore = true;
   
       TransformerHandler getTransformerHandler(EntityResolver resolver, String 
xsluri)
         throws SAXException, ProcessingException, IOException, 
TransformerConfigurationException
  @@ -86,23 +86,23 @@
           InputSource src = resolver.resolveEntity(null, xsluri);
           String      systemID = src.getSystemId();
   
  -        if (this.useCache == true)
  +        if (this.useStore == true)
           {
               // Is this a local file
               if (systemID.startsWith(FILE) == true) {
  -                // Cached is an array of the template and the caching time
  +                // Stored is an array of the template and the caching time
                   if (store.containsKey(xsluri) == true) {
                       Object[] templateAndTime = (Object[])store.get(xsluri);
                       File xslFile = new 
File(systemID.substring(FILE.length()));
  -                    long cachedTime = ((Long)templateAndTime[1]).longValue();
  -                    if (cachedTime < xslFile.lastModified()) {
  +                    long storedTime = ((Long)templateAndTime[1]).longValue();
  +                    if (storedTime < xslFile.lastModified()) {
                           templates = null;
                       } else {
                           templates = (Templates)templateAndTime[0];
                       }
                   }
               } else {
  -                // only the template is cached
  +                // only the template is stored
                   if (store.containsKey(xsluri) == true) {
                      templates = (Templates)store.get(xsluri);
                   }
  @@ -111,11 +111,11 @@
           if(templates == null)
           {
               templates = tfactory.newTemplates(new SAXSource(new 
InputSource(systemID)));
  -            if (this.useCache == true)
  +            if (this.useStore == true)
               {
                   // Is this a local file
                   if (systemID.startsWith(FILE) == true) {
  -                    // Cached is an array of the template and the current 
time
  +                    // Stored is an array of the template and the current 
time
                       Object[] templateAndTime = new Object[2];
                       templateAndTime[0] = templates;
                       templateAndTime[1] = new 
Long(System.currentTimeMillis());
  @@ -134,8 +134,8 @@
       public void configure(Configuration conf)
       throws ConfigurationException {
           if (conf != null) {
  -            Configuration child = conf.getChild("use-cache");
  -            this.useCache = child.getValueAsBoolean(true);
  +            Configuration child = conf.getChild("use-store");
  +            this.useStore = child.getValueAsBoolean(true);
           }
       }
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.56  +19 -3     
xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java
  
  Index: CocoonServlet.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java,v
  retrieving revision 1.1.4.55
  retrieving revision 1.1.4.56
  diff -u -r1.1.4.55 -r1.1.4.56
  --- CocoonServlet.java        2001/02/14 05:08:42     1.1.4.55
  +++ CocoonServlet.java        2001/02/14 18:20:14     1.1.4.56
  @@ -39,6 +39,7 @@
   import org.apache.cocoon.Notification;
   import org.apache.cocoon.ResourceNotFoundException;
   import org.apache.cocoon.environment.http.HttpEnvironment;
  +import org.apache.cocoon.environment.Environment;
   import org.apache.cocoon.util.ClassUtils;
   import org.apache.cocoon.util.NetUtils;
   import org.apache.cocoon.util.IOUtils;
  @@ -59,7 +60,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa
    * @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
  - * @version CVS $Revision: 1.1.4.55 $ $Date: 2001/02/14 05:08:42 $
  + * @version CVS $Revision: 1.1.4.56 $ $Date: 2001/02/14 18:20:14 $
    */
   
   public class CocoonServlet extends HttpServlet {
  @@ -326,8 +327,7 @@
                   uri = uri.substring(1);
               }
   
  -            HttpEnvironment env = new HttpEnvironment(uri, req, res, 
(ServletContext) this.appContext.get(Constants.CONTEXT_SERVLET_CONTEXT));
  -            env.setLogger(this.log);
  +            Environment env = this.getEnvironment(uri, req, res);
   
               if (!this.cocoon.process(env)) {
   
  @@ -392,6 +392,22 @@
           }
   
           out.flush();
  +    }
  +
  +    /**
  +     * Create the environment for the request
  +     */
  +    private Environment getEnvironment(String uri,
  +                                       HttpServletRequest req,
  +                                       HttpServletResponse res)
  +    throws Exception {
  +        HttpEnvironment env;
  +        env = new HttpEnvironment(uri,
  +                                  req,
  +                                  res,
  +                                  (ServletContext) 
this.appContext.get(Constants.CONTEXT_SERVLET_CONTEXT));
  +        env.setLogger(this.log);
  +        return env;
       }
   
       /**
  
  
  

Reply via email to