cvs commit: jakarta-struts/src/share/org/apache/struts/actions LocaleAction.java

2004-01-01 Thread husted
husted  2004/01/01 05:45:49

  Added:   src/share/org/apache/struts/actions LocaleAction.java
  Log:
  Move LocaleAction from Validator example webapp to standard Actions package, so that 
it can be used in other examples and tests.
  
  Revision  ChangesPath
  1.1  
jakarta-struts/src/share/org/apache/struts/actions/LocaleAction.java
  
  Index: LocaleAction.java
  ===
  /*
   * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/actions/LocaleAction.java,v 1.1 
2004/01/01 13:45:49 husted Exp $
   * $Revision: 1.1 $
   * $Date: 2004/01/01 13:45:49 $
   *
   * 
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 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 acknowledgement:
   *   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, Struts, 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 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/.
   */
  
  
  package org.apache.struts.actions;
  
  import java.util.Locale;
  
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import javax.servlet.http.HttpSession;
  
  import org.apache.commons.beanutils.PropertyUtils;
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.apache.struts.Globals;
  import org.apache.struts.action.Action;
  import org.apache.struts.action.ActionForm;
  import org.apache.struts.action.ActionForward;
  import org.apache.struts.action.ActionMapping;
  
  
  /**
   * Implementation of strongAction/strong that changes the user's
   * @link(java.util.Locale and forwards to a page, based on request level
   * parameters that are set  (language, country, amp; page).
   *
   * @author David Wintefeldt
  */
  public final class LocaleAction extends Action {
  
  /**
   * Commons Logging instance.
  */
  private Log log = LogFactory.getFactory().getInstance(this.getClass().getName());
  
  /**
   * p
   * Change the user's @link(java.util.Locale) based on @link(ActionForm)
   * properties.
   * /p
   * p
   * This codeAction/code looks for codelanguage/code and
   * codecountry/code properties on the given form, constructs an
   * appropriate Locale object, and sets it as the Struts Locale for this
   * user's session.
   * Any codeActionForm, including a @link(DynaActionForm), may be used.
   * /p
   * p
   * If a codepage/code property is also provided, then 

Re: cvs commit: jakarta-struts/src/share/org/apache/struts/actions LocaleAction.java

2004-01-01 Thread David Graham
I don't think the reason for this change is valid.  If you only want to
use
this action in examples and tests it doesn't belong in the standard
actions package which allows it to be used in applications and requires
support.  

The action is an ok example but it's not generally seful enough to warrant
promotion to the main Struts distro.  More importantly, the code isn't
ready for the main distro as it catches Exception and hardcodes the
success forward name.

David

--- [EMAIL PROTECTED] wrote:
 husted  2004/01/01 05:45:49
 
   Added:   src/share/org/apache/struts/actions LocaleAction.java
   Log:
   Move LocaleAction from Validator example webapp to standard Actions
 package, so that it can be used in other examples and tests.
   
   Revision  ChangesPath
   1.1 
 jakarta-struts/src/share/org/apache/struts/actions/LocaleAction.java
   
   Index: LocaleAction.java
   ===
   /*
* $Header:

/home/cvs/jakarta-struts/src/share/org/apache/struts/actions/LocaleAction.java,v
 1.1 2004/01/01 13:45:49 husted Exp $
* $Revision: 1.1 $
* $Date: 2004/01/01 13:45:49 $
*
*
 
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2003 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 acknowledgement:
*   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, Struts, 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 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/.
*/
   
   
   package org.apache.struts.actions;
   
   import java.util.Locale;
   
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   import javax.servlet.http.HttpSession;
   
   import org.apache.commons.beanutils.PropertyUtils;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.struts.Globals;
   import org.apache.struts.action.Action;
   import org.apache.struts.action.ActionForm;
   import org.apache.struts.action.ActionForward;
   import org.apache.struts.action.ActionMapping;
   
   
   /**
* Implementation of strongAction/strong that changes the user's
* @link(java.util.Locale and forwards to a page, based on request
 level
* parameters that are set  (language, country, amp; page).
*
* @author David Wintefeldt
   */
   public final class LocaleAction extends Action {
   
   /**
* Commons Logging instance.
   */
   private Log