husted      02/01/24 07:22:57

  Modified:    contrib/scaffold/src/framework/main/org/apache/scaffold/http
                        FindForwardAction.java
  Added:       contrib/scaffold/src/framework/main/org/apache/scaffold/http
                        ResetAction.java RemoveHelper.java Parameter.java
                        ModelRelay.java
  Log:
  Additional standard actions.
  
  Revision  Changes    Path
  1.4       +7 -6      
jakarta-struts/contrib/scaffold/src/framework/main/org/apache/scaffold/http/FindForwardAction.java
  
  Index: FindForwardAction.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/contrib/scaffold/src/framework/main/org/apache/scaffold/http/FindForwardAction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FindForwardAction.java    23 Jan 2002 21:40:52 -0000      1.3
  +++ FindForwardAction.java    24 Jan 2002 15:22:56 -0000      1.4
  @@ -13,8 +13,8 @@
   import org.apache.struts.action.ActionMapping;
   import org.apache.struts.action.ActionServlet;
   
  -import org.apache.struts.config.ApplicationConfig;
  -import org.apache.struts.config.ForwardConfig;
  +// import org.apache.struts.config.ApplicationConfig;
  +// import org.apache.struts.config.ForwardConfig;
   
   
   import org.apache.scaffold.lang.Tokens;
  @@ -24,7 +24,8 @@
    * Scan request parameters for the name of a local or global
    * forward. If one is found, use it. If not, return null.
    * @author Dmitri Valdin
  - * @version $Revision: 1.3 $ $Date: 2002/01/23 21:40:52 $
  + * @author Ted Husted
  + * @version $Revision: 1.4 $ $Date: 2002/01/24 15:22:56 $
   **/
   public final class FindForwardAction extends Action {
   
  @@ -65,9 +66,9 @@
   
   
   /*
  - * $Header: 
/home/cvs/jakarta-struts/contrib/scaffold/src/framework/main/org/apache/scaffold/http/FindForwardAction.java,v
 1.3 2002/01/23 21:40:52 husted Exp $
  - * $Revision: 1.3 $
  - * $Date: 2002/01/23 21:40:52 $
  + * $Header: 
/home/cvs/jakarta-struts/contrib/scaffold/src/framework/main/org/apache/scaffold/http/FindForwardAction.java,v
 1.4 2002/01/24 15:22:56 husted Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/01/24 15:22:56 $
    *
    * ====================================================================
    *
  
  
  
  1.1                  
jakarta-struts/contrib/scaffold/src/framework/main/org/apache/scaffold/http/ResetAction.java
  
  Index: ResetAction.java
  ===================================================================
  package org.apache.scaffold.http;
  
  
  import java.io.IOException;
  
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  import org.apache.struts.action.Action;
  import org.apache.struts.action.ActionForm;
  import org.apache.struts.action.ActionForward;
  import org.apache.struts.action.ActionMapping;
  import org.apache.struts.action.ActionServlet;
  
  import org.apache.scaffold.lang.Tokens;
  
  
  /**
   * Standard Action to reset form bean and then
   * forward control to continue.
   * Useful for workflow loops where bean should be
   * reset, but request context not cleared.
   * @author Ted Husted
   * @version $Revision: 1.1 $ $Date: 2002/01/24 15:22:56 $
  **/
  public final class ResetAction extends Action {
  
      /**
       * @param mapping The ActionMapping used to select this instance
       * @param actionForm The optional ActionForm bean for this request (if any)
       * @param request The HTTP request we are processing
       * @param response The HTTP response we are creating
       * @exception IOException if an input/output error occurs
       * @exception ServletException if a servlet exception occurs
      **/
      public ActionForward perform(ActionMapping mapping,
                   ActionForm form,
                   HttpServletRequest request,
                   HttpServletResponse response)
      throws IOException, ServletException {
  
          form.reset(mapping, request);
          return mapping.findForward(Tokens.CONTINUE);
  
      }
  
  } // end ResetAction
  
  
  /*
   * $Header: 
/home/cvs/jakarta-struts/contrib/scaffold/src/framework/main/org/apache/scaffold/http/ResetAction.java,v
 1.1 2002/01/24 15:22:56 husted Exp $
   * $Revision: 1.1 $
   * $Date: 2002/01/24 15:22:56 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Scaffold", and "Apache Software
   *    Foundation" 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"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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/>.
   *
  **/
  
  
  
  
  
  
  
  1.1                  
jakarta-struts/contrib/scaffold/src/framework/main/org/apache/scaffold/http/RemoveHelper.java
  
  Index: RemoveHelper.java
  ===================================================================
  package org.apache.scaffold.http;
  
  
  import java.io.IOException;
  
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  import org.apache.struts.action.Action;
  import org.apache.struts.action.ActionForm;
  import org.apache.struts.action.ActionForward;
  import org.apache.struts.action.ActionMapping;
  import org.apache.struts.action.ActionServlet;
  
  import org.apache.scaffold.lang.Tokens;
  
  
  /**
   * Standard Action to forward control to continue.
   * Useful for prototyping flow during development,
   * and for creating blank forms for new input.
   * @author Ted Husted
   * @version $Revision: 1.1 $ $Date: 2002/01/24 15:22:56 $
   */
  public final class RemoveHelper extends Action {
  
      /**
       * @param mapping The ActionMapping used to select this instance
       * @param actionForm The ActionForm bean for this request (if any)
       * @param request The HTTP request we are processing
       * @param response The HTTP response we are creating
       * @exception IOException if an input/output error occurs
       * @exception ServletException if a servlet exception occurs
       */
      public ActionForward perform(ActionMapping mapping,
                   ActionForm form,
                   HttpServletRequest request,
                   HttpServletResponse response)
      throws IOException, ServletException {
  
         request.getSession().removeAttribute(
             mapping.getParameter());
         return mapping.findForward(Tokens.CONTINUE);
  
      }
  
  } // end RemoveHelperAction
  
  
  /*
   * $Header: 
/home/cvs/jakarta-struts/contrib/scaffold/src/framework/main/org/apache/scaffold/http/RemoveHelper.java,v
 1.1 2002/01/24 15:22:56 husted Exp $
   * $Revision: 1.1 $
   * $Date: 2002/01/24 15:22:56 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" 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"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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/>.
   *
   */
  
  
  
  
  
  
  
  1.1                  
jakarta-struts/contrib/scaffold/src/framework/main/org/apache/scaffold/http/Parameter.java
  
  Index: Parameter.java
  ===================================================================
  package org.apache.scaffold.http;
  
  
  import java.io.IOException;
  import java.util.Map;
  
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  import org.apache.scaffold.lang.Tokens;
  
  import org.apache.struts.action.Action;
  import org.apache.struts.action.ActionError;
  import org.apache.struts.action.ActionErrors;
  import org.apache.struts.action.ActionForm;
  import org.apache.struts.action.ActionForward;
  import org.apache.struts.action.ActionMapping;
  import org.apache.struts.action.ActionServlet;
  
  
  /**
   * Standard Action to append a passed parameter to query string.
   * @author Ted Husted
   * @version $Revision: 1.1 $ $Date: 2002/01/24 15:22:56 $
   */
  public class Parameter extends Action {
  
      /**
       * @param mapping The ActionMapping used to select this instance
       * @param actionForm The optional ActionForm bean for this request (if any)
       * @param request The HTTP request we are processing
       * @param helper The helper object
       * @exception IOException if an input/output error occurs
       * @exception ServletException if a servlet exception occurs
       * :FIXME: is there any valid use of the response here?
       */
       public ActionForward perform(
           ActionMapping mapping,
           ActionForm form,
           HttpServletRequest request,
           HttpServletResponse response) {
  
              // Get "forward" parameter
          String parameter = request.getParameter(Tokens.FORWARD);
              // Get parameter name for this mapping
          String paramName = mapping.getParameter();
  
          StringBuffer path = new StringBuffer(64);
  
              // Get stub URI from mapping (/do/whatever?paramName=)
          path.append(mapping.findForward(parameter).getPath());
              // Append the value passed (/do/whatever?paramName=paramProperty)
          path.append(request.getParameter(paramName));
  
              // Return a new forward based on stub+value
          return new ActionForward(path.toString());
  
      }
  
  
  } // end Parameter
  
  
  /*
   * $Header: 
/home/cvs/jakarta-struts/contrib/scaffold/src/framework/main/org/apache/scaffold/http/Parameter.java,v
 1.1 2002/01/24 15:22:56 husted Exp $
   * $Revision: 1.1 $
   * $Date: 2002/01/24 15:22:56 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" 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"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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/>.
   *
   */
  
  
  
  
  
  
  
  1.1                  
jakarta-struts/contrib/scaffold/src/framework/main/org/apache/scaffold/http/ModelRelay.java
  
  Index: ModelRelay.java
  ===================================================================
  package org.apache.scaffold.http;
  
  
  import java.io.IOException;
  import java.util.Map;
  
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  // import org.apache.struts.action.Action;
  import org.apache.struts.action.ActionError;
  import org.apache.struts.action.ActionErrors;
  import org.apache.struts.action.ActionForm;
  import org.apache.struts.action.ActionForward;
  import org.apache.struts.action.ActionMapping;
  import org.apache.struts.action.ActionServlet;
  
  import org.apache.scaffold.lang.Tokens;
  import org.apache.scaffold.model.ModelBean;
  import org.apache.scaffold.model.ModelException;
  import org.apache.scaffold.model.ModelResult;
  
  
  /**
   * Standard Action to manage helper objects, and relay outcome.
   * @author Ted Husted
   * @version $Revision: 1.1 $ $Date: 2002/01/24 15:22:56 $
   */
  public class ModelRelay extends ModelHelper {
  
      /**
       * @param mapping The ActionMapping used to select this instance
       * @param actionForm The optional ActionForm bean for this request (if any)
       * @param request The HTTP request we are processing
       * @param helper The helper object
       * @exception IOException if an input/output error occurs
       * @exception ServletException if a servlet exception occurs
       * :FIXME: is there any valid use of the response here?
       */
       public ActionForward getContinue(
           ActionMapping mapping,
           ActionForm form,
           HttpServletRequest request,
           HttpServletResponse response,
           Object[] helpers
           ) {
  
          return mapping.findForward(request.getParameter(Tokens.FORWARD));
  
      }
  
  
  } // end ModelRelay
  
  
  /*
   * $Header: 
/home/cvs/jakarta-struts/contrib/scaffold/src/framework/main/org/apache/scaffold/http/ModelRelay.java,v
 1.1 2002/01/24 15:22:56 husted Exp $
   * $Revision: 1.1 $
   * $Date: 2002/01/24 15:22:56 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" 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"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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/>.
   *
   */
  
  
  
  
  
  
  

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

Reply via email to