I love the new pipeline. It's good to see it coming along.

I have a web flow that uses a request tool to capture inform/error 
messages. In testing, it continued to grow. Basically, because the 
request tools weren't being refreshed. I took a stab at implementing 
the correction. All 10 lines of code. Below is the patch to existing 
code and attached is a new java source file. I tried my best to 
comply.

Thanks,
Evan

Index: conf/turbine-classic-pipeline.xml
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine-3/conf/turbine-classic-pipeline.xml,v
retrieving revision 1.3
diff -u -r1.3 turbine-classic-pipeline.xml
--- conf/turbine-classic-pipeline.xml   18 Jan 2002 22:32:40 -0000      
1.3
+++ conf/turbine-classic-pipeline.xml   4 Jun 2002 03:35:41 -0000
@@ -10,5 +10,6 @@
     <valve 
className="org.apache.turbine.pipeline.DefaultActionValve"/>
     <valve className="org.apache.turbine.pipeline.RunModulesValve"/>
     <valve 
className="org.apache.turbine.pipeline.DefaultTargetValve"/>
+    <valve 
className="org.apache.turbine.pipeline.DefaultReleaseRequestToolsValve"/>
   </valves>
 </pipeline>
Index: 
src/java/org/apache/turbine/services/pull/TurbinePullService.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine-3/src/java/org/apache/turbine/services/pull/TurbinePullService.java,v
retrieving revision 1.15
diff -u -r1.15 TurbinePullService.java
--- src/java/org/apache/turbine/services/pull/TurbinePullService.java   
24 Apr 2002 20:03:25 -0000      1.15
+++ src/java/org/apache/turbine/services/pull/TurbinePullService.java   
4 Jun 2002 03:35:42 -0000
@@ -631,6 +631,7 @@
             context.remove(toolData.toolName);
             if (tool != null)
             {
+               ((ApplicationTool) tool).refresh();
                 pool.putInstance(tool);
             }
         }
package org.apache.turbine.pipeline;

/* ====================================================================
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Apache" and "Apache Software Foundation" and
 *    "Apache Turbine" must not be used to endorse or promote products
 *    derived from this software without prior written permission. For
 *    written permission, please contact [EMAIL PROTECTED]
 *
 * 5. Products derived from this software may not be called "Apache",
 *    "Apache Turbine", nor may "Apache" appear in their name, without
 *    prior written permission of the Apache Software Foundation.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the Apache Software Foundation.  For more
 * information on the Apache Software Foundation, please see
 * <http://www.apache.org/>.
 */


import java.io.IOException;

import org.apache.turbine.RunData;
import org.apache.turbine.TemplateContext;
import org.apache.turbine.TurbineException;
import org.apache.turbine.ValveContext;
import org.apache.turbine.modules.Module;
import org.apache.turbine.services.pull.TurbinePull;

/**
 * This valve is responsible for cleaning up request tools. Ultimately,
 * the request tool is refreshed and put back into the pool.
 * 
 * This valve wants to occur after the main processing valve has been
 * called.
 */
public class DefaultReleaseRequestToolsValve extends AbstractValve {

    /**
     * At the end of the pipeline, the request tools need to be removed
     * from the context, refreshed, and put back into the pool.
     * 
     * @see org.apache.turbine.Valve#invoke(RunData, ValveContext)
     */
	public void invoke(RunData data, ValveContext context)
		throws IOException, TurbineException {
			
			// Get the Template Context, since that's what TurbinePull needs
            TemplateContext templateContext = Module.getTemplateContext( data );

			// Get the PullService
			TurbinePull.releaseTools(templateContext);
			
	}

}


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to