craigmcc 01/02/11 16:32:16 Modified: src/share/org/apache/struts/util ArrayStack.java BeanUtils.java ConvertUtils.java ErrorMessages.java FastArrayList.java FastHashMap.java FastTreeMap.java GenericConnection.java GenericDataSource.java MessageResources.java MessageResourcesFactory.java PropertyMessageResources.java PropertyMessageResourcesFactory.java PropertyUtils.java RequestUtils.java ServletContextWriter.java Added: src/share/org/apache/struts/util ResponseUtils.java Log: Clean up the copyright dates and package name in the licenses. Add ResponseUtils (and update RequestUtils) to contain more code that can be factored out of individual custom tag implementation classes. Revision Changes Path 1.2 +6 -6 jakarta-struts/src/share/org/apache/struts/util/ArrayStack.java Index: ArrayStack.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/ArrayStack.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ArrayStack.java 2000/12/28 01:55:14 1.1 +++ ArrayStack.java 2001/02/12 00:32:12 1.2 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/ArrayStack.java,v 1.1 2000/12/28 01:55:14 craigmcc Exp $ - * $Revision: 1.1 $ - * $Date: 2000/12/28 01:55:14 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/ArrayStack.java,v 1.2 2001/02/12 00:32:12 craigmcc Exp $ + * $Revision: 1.2 $ + * $Date: 2001/02/12 00:32:12 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * 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 + * 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] @@ -75,7 +75,7 @@ * externally if an instance is referenced from multiple threads. * * @author Craig R. McClanahan - * @version $Revision: 1.1 $ $Date: 2000/12/28 01:55:14 $ + * @version $Revision: 1.2 $ $Date: 2001/02/12 00:32:12 $ */ public class ArrayStack implements Serializable { 1.26 +9 -31 jakarta-struts/src/share/org/apache/struts/util/BeanUtils.java Index: BeanUtils.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/BeanUtils.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- BeanUtils.java 2001/01/28 04:51:13 1.25 +++ BeanUtils.java 2001/02/12 00:32:12 1.26 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/BeanUtils.java,v 1.25 2001/01/28 04:51:13 craigmcc Exp $ - * $Revision: 1.25 $ - * $Date: 2001/01/28 04:51:13 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/BeanUtils.java,v 1.26 2001/02/12 00:32:12 craigmcc Exp $ + * $Revision: 1.26 $ + * $Date: 2001/02/12 00:32:12 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * 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 + * 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] @@ -83,7 +83,7 @@ * @author Craig R. McClanahan * @author Ralph Schaer * @author Chris Audley - * @version $Revision: 1.25 $ $Date: 2001/01/28 04:51:13 $ + * @version $Revision: 1.26 $ $Date: 2001/02/12 00:32:12 $ */ public final class BeanUtils { @@ -158,34 +158,12 @@ * by the corresponding character entities. * * @param value The string to be filtered and returned + * + * @deprecated Use ResponseUtils.filter() instead */ public static String filter(String value) { - - if (value == null) - return (null); - char content[] = new char[value.length()]; - value.getChars(0, value.length(), content, 0); - StringBuffer result = new StringBuffer(content.length + 50); - for (int i = 0; i < content.length; i++) { - switch (content[i]) { - case '<': - result.append("<"); - break; - case '>': - result.append(">"); - break; - case '&': - result.append("&"); - break; - case '"': - result.append("""); - break; - default: - result.append(content[i]); - } - } - return (result.toString()); + return (ResponseUtils.filter(value)); } 1.7 +5 -5 jakarta-struts/src/share/org/apache/struts/util/ConvertUtils.java Index: ConvertUtils.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/ConvertUtils.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- ConvertUtils.java 2001/02/02 02:57:50 1.6 +++ ConvertUtils.java 2001/02/12 00:32:12 1.7 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/ConvertUtils.java,v 1.6 2001/02/02 02:57:50 craigmcc Exp $ - * $Revision: 1.6 $ - * $Date: 2001/02/02 02:57:50 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/ConvertUtils.java,v 1.7 2001/02/12 00:32:12 craigmcc Exp $ + * $Revision: 1.7 $ + * $Date: 2001/02/12 00:32:12 $ * * ==================================================================== * @@ -29,7 +29,7 @@ * 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 + * 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] @@ -77,7 +77,7 @@ * @author Craig R. McClanahan * @author Ralph Schaer * @author Chris Audley - * @version $Revision: 1.6 $ $Date: 2001/02/02 02:57:50 $ + * @version $Revision: 1.7 $ $Date: 2001/02/12 00:32:12 $ */ public final class ConvertUtils { 1.4 +6 -6 jakarta-struts/src/share/org/apache/struts/util/ErrorMessages.java Index: ErrorMessages.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/ErrorMessages.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ErrorMessages.java 2000/10/12 21:51:47 1.3 +++ ErrorMessages.java 2001/02/12 00:32:13 1.4 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/ErrorMessages.java,v 1.3 2000/10/12 21:51:47 craigmcc Exp $ - * $Revision: 1.3 $ - * $Date: 2000/10/12 21:51:47 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/ErrorMessages.java,v 1.4 2001/02/12 00:32:13 craigmcc Exp $ + * $Revision: 1.4 $ + * $Date: 2001/02/12 00:32:13 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * 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 + * 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] @@ -81,7 +81,7 @@ * @deprecated Use org.apache.struts.action.ActionErrors instead * * @author David Geary - * @revision $Revision: 1.3 $ $Date: 2000/10/12 21:51:47 $ + * @revision $Revision: 1.4 $ $Date: 2001/02/12 00:32:13 $ */ public class ErrorMessages { 1.3 +6 -6 jakarta-struts/src/share/org/apache/struts/util/FastArrayList.java Index: FastArrayList.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/FastArrayList.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- FastArrayList.java 2000/12/30 19:08:54 1.2 +++ FastArrayList.java 2001/02/12 00:32:13 1.3 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/FastArrayList.java,v 1.2 2000/12/30 19:08:54 craigmcc Exp $ - * $Revision: 1.2 $ - * $Date: 2000/12/30 19:08:54 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/FastArrayList.java,v 1.3 2001/02/12 00:32:13 craigmcc Exp $ + * $Revision: 1.3 $ + * $Date: 2001/02/12 00:32:13 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * 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 + * 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] @@ -97,7 +97,7 @@ * overridden: clone(), equals(Object), hashCode().</p> * * @author Craig R. McClanahan - * @version $Revision: 1.2 $ $Date: 2000/12/30 19:08:54 $ + * @version $Revision: 1.3 $ $Date: 2001/02/12 00:32:13 $ */ public class FastArrayList implements List, Cloneable, Serializable { 1.3 +6 -6 jakarta-struts/src/share/org/apache/struts/util/FastHashMap.java Index: FastHashMap.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/FastHashMap.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- FastHashMap.java 2000/12/30 19:08:55 1.2 +++ FastHashMap.java 2001/02/12 00:32:13 1.3 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/FastHashMap.java,v 1.2 2000/12/30 19:08:55 craigmcc Exp $ - * $Revision: 1.2 $ - * $Date: 2000/12/30 19:08:55 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/FastHashMap.java,v 1.3 2001/02/12 00:32:13 craigmcc Exp $ + * $Revision: 1.3 $ + * $Date: 2001/02/12 00:32:13 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * 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 + * 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] @@ -97,7 +97,7 @@ * overridden: clone(), equals(Object), hashCode().</p> * * @author Craig R. McClanahan - * @version $Revision: 1.2 $ $Date: 2000/12/30 19:08:55 $ + * @version $Revision: 1.3 $ $Date: 2001/02/12 00:32:13 $ */ public class FastHashMap implements Map, Cloneable, Serializable { 1.2 +6 -6 jakarta-struts/src/share/org/apache/struts/util/FastTreeMap.java Index: FastTreeMap.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/FastTreeMap.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- FastTreeMap.java 2000/12/30 19:35:16 1.1 +++ FastTreeMap.java 2001/02/12 00:32:13 1.2 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/FastTreeMap.java,v 1.1 2000/12/30 19:35:16 craigmcc Exp $ - * $Revision: 1.1 $ - * $Date: 2000/12/30 19:35:16 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/FastTreeMap.java,v 1.2 2001/02/12 00:32:13 craigmcc Exp $ + * $Revision: 1.2 $ + * $Date: 2001/02/12 00:32:13 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * 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 + * 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] @@ -99,7 +99,7 @@ * overridden: clone(), equals(Object), hashCode().</p> * * @author Craig R. McClanahan - * @version $Revision: 1.1 $ $Date: 2000/12/30 19:35:16 $ + * @version $Revision: 1.2 $ $Date: 2001/02/12 00:32:13 $ */ public class FastTreeMap implements Map, Cloneable, Serializable { 1.9 +6 -6 jakarta-struts/src/share/org/apache/struts/util/GenericConnection.java Index: GenericConnection.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/GenericConnection.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- GenericConnection.java 2001/02/09 20:48:34 1.8 +++ GenericConnection.java 2001/02/12 00:32:13 1.9 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/GenericConnection.java,v 1.8 2001/02/09 20:48:34 craigmcc Exp $ - * $Revision: 1.8 $ - * $Date: 2001/02/09 20:48:34 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/GenericConnection.java,v 1.9 2001/02/12 00:32:13 craigmcc Exp $ + * $Revision: 1.9 $ + * $Date: 2001/02/12 00:32:13 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * 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 + * 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] @@ -82,7 +82,7 @@ * * @author Craig R. McClanahan * @author Ted Husted - * @version $Revision: 1.8 $ $Date: 2001/02/09 20:48:34 $ + * @version $Revision: 1.9 $ $Date: 2001/02/12 00:32:13 $ */ 1.4 +6 -6 jakarta-struts/src/share/org/apache/struts/util/GenericDataSource.java Index: GenericDataSource.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/GenericDataSource.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- GenericDataSource.java 2001/01/08 23:53:10 1.3 +++ GenericDataSource.java 2001/02/12 00:32:13 1.4 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/GenericDataSource.java,v 1.3 2001/01/08 23:53:10 husted Exp $ - * $Revision: 1.3 $ - * $Date: 2001/01/08 23:53:10 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/GenericDataSource.java,v 1.4 2001/02/12 00:32:13 craigmcc Exp $ + * $Revision: 1.4 $ + * $Date: 2001/02/12 00:32:13 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * 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 + * 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] @@ -158,7 +158,7 @@ * * @author Craig R. McClanahan * @author Ted Husted - * @version $Revision: 1.3 $ $Date: 2001/01/08 23:53:10 $ + * @version $Revision: 1.4 $ $Date: 2001/02/12 00:32:13 $ */ public class GenericDataSource implements DataSource { 1.9 +6 -6 jakarta-struts/src/share/org/apache/struts/util/MessageResources.java Index: MessageResources.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/MessageResources.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- MessageResources.java 2001/01/16 03:52:57 1.8 +++ MessageResources.java 2001/02/12 00:32:13 1.9 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/MessageResources.java,v 1.8 2001/01/16 03:52:57 craigmcc Exp $ - * $Revision: 1.8 $ - * $Date: 2001/01/16 03:52:57 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/MessageResources.java,v 1.9 2001/02/12 00:32:13 craigmcc Exp $ + * $Revision: 1.9 $ + * $Date: 2001/02/12 00:32:13 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * 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 + * 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] @@ -89,7 +89,7 @@ * application server environments. * * @author Craig R. McClanahan - * @version $Revision: 1.8 $ $Date: 2001/01/16 03:52:57 $ + * @version $Revision: 1.9 $ $Date: 2001/02/12 00:32:13 $ */ public abstract class MessageResources implements Serializable { 1.4 +6 -6 jakarta-struts/src/share/org/apache/struts/util/MessageResourcesFactory.java Index: MessageResourcesFactory.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/MessageResourcesFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- MessageResourcesFactory.java 2001/01/24 17:25:36 1.3 +++ MessageResourcesFactory.java 2001/02/12 00:32:13 1.4 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/MessageResourcesFactory.java,v 1.3 2001/01/24 17:25:36 craigmcc Exp $ - * $Revision: 1.3 $ - * $Date: 2001/01/24 17:25:36 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/MessageResourcesFactory.java,v 1.4 2001/02/12 00:32:13 craigmcc Exp $ + * $Revision: 1.4 $ + * $Date: 2001/02/12 00:32:13 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * 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 + * 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] @@ -81,7 +81,7 @@ * </ul> * * @author Craig R. McClanahan - * @version $Revision: 1.3 $ $Date: 2001/01/24 17:25:36 $ + * @version $Revision: 1.4 $ $Date: 2001/02/12 00:32:13 $ */ public abstract class MessageResourcesFactory implements Serializable { 1.3 +6 -6 jakarta-struts/src/share/org/apache/struts/util/PropertyMessageResources.java Index: PropertyMessageResources.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/PropertyMessageResources.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- PropertyMessageResources.java 2000/12/26 20:07:00 1.2 +++ PropertyMessageResources.java 2001/02/12 00:32:14 1.3 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/PropertyMessageResources.java,v 1.2 2000/12/26 20:07:00 craigmcc Exp $ - * $Revision: 1.2 $ - * $Date: 2000/12/26 20:07:00 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/PropertyMessageResources.java,v 1.3 2001/02/12 00:32:14 craigmcc Exp $ + * $Revision: 1.3 $ + * $Date: 2001/02/12 00:32:14 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * 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 + * 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] @@ -85,7 +85,7 @@ * the same locale + key combination. * * @author Craig R. McClanahan - * @version $Revision: 1.2 $ $Date: 2000/12/26 20:07:00 $ + * @version $Revision: 1.3 $ $Date: 2001/02/12 00:32:14 $ */ public class PropertyMessageResources extends MessageResources { 1.2 +6 -6 jakarta-struts/src/share/org/apache/struts/util/PropertyMessageResourcesFactory.java Index: PropertyMessageResourcesFactory.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/PropertyMessageResourcesFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- PropertyMessageResourcesFactory.java 2000/12/15 03:08:11 1.1 +++ PropertyMessageResourcesFactory.java 2001/02/12 00:32:14 1.2 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/PropertyMessageResourcesFactory.java,v 1.1 2000/12/15 03:08:11 craigmcc Exp $ - * $Revision: 1.1 $ - * $Date: 2000/12/15 03:08:11 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/PropertyMessageResourcesFactory.java,v 1.2 2001/02/12 00:32:14 craigmcc Exp $ + * $Revision: 1.2 $ + * $Date: 2001/02/12 00:32:14 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * 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 + * 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] @@ -70,7 +70,7 @@ * loaded. * * @author Craig R. McClanahan - * @version $Revision: 1.1 $ $Date: 2000/12/15 03:08:11 $ + * @version $Revision: 1.2 $ $Date: 2001/02/12 00:32:14 $ */ public class PropertyMessageResourcesFactory extends MessageResourcesFactory { 1.13 +6 -6 jakarta-struts/src/share/org/apache/struts/util/PropertyUtils.java Index: PropertyUtils.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/PropertyUtils.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- PropertyUtils.java 2001/02/03 02:12:25 1.12 +++ PropertyUtils.java 2001/02/12 00:32:14 1.13 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/PropertyUtils.java,v 1.12 2001/02/03 02:12:25 craigmcc Exp $ - * $Revision: 1.12 $ - * $Date: 2001/02/03 02:12:25 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/PropertyUtils.java,v 1.13 2001/02/12 00:32:14 craigmcc Exp $ + * $Revision: 1.13 $ + * $Date: 2001/02/12 00:32:14 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * 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 + * 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] @@ -117,7 +117,7 @@ * @author Craig R. McClanahan * @author Ralph Schaer * @author Chris Audley - * @version $Revision: 1.12 $ $Date: 2001/02/03 02:12:25 $ + * @version $Revision: 1.13 $ $Date: 2001/02/12 00:32:14 $ */ public final class PropertyUtils { 1.5 +103 -11 jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java Index: RequestUtils.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- RequestUtils.java 2001/01/10 01:54:21 1.4 +++ RequestUtils.java 2001/02/12 00:32:14 1.5 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v 1.4 2001/01/10 01:54:21 craigmcc Exp $ - * $Revision: 1.4 $ - * $Date: 2001/01/10 01:54:21 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v 1.5 2001/02/12 00:32:14 craigmcc Exp $ + * $Revision: 1.5 $ + * $Date: 2001/02/12 00:32:14 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * 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 + * 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] @@ -63,6 +63,7 @@ package org.apache.struts.util; +import java.lang.reflect.InvocationTargetException; import java.net.MalformedURLException; import java.net.URL; import java.util.Enumeration; @@ -72,6 +73,7 @@ import java.util.Map; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; +import javax.servlet.jsp.JspException; import javax.servlet.jsp.PageContext; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; @@ -86,12 +88,24 @@ * in the Struts controller framework. * * @author Craig R. McClanahan - * @version $Revision: 1.4 $ $Date: 2001/01/10 01:54:21 $ + * @version $Revision: 1.5 $ $Date: 2001/02/12 00:32:14 $ */ public class RequestUtils { + // ------------------------------------------------------- Static Variables + + + /** + * The message resources for this package. + */ + private static MessageResources messages = + MessageResources.getMessageResources + ("org.apache.struts.util.LocalStrings"); + + + // --------------------------------------------------------- Public Methods @@ -121,18 +135,19 @@ /** * Locate and return the specified bean, from an optionally specified * scope, in the specified page context. If no such bean is found, - * return <code>null</code> instead. + * return <code>null</code> instead. If an exception is thrown, it will + * have already been saved via a call to <code>saveException()</code>. * * @param pageContext Page context to be searched * @param name Name of the bean to be retrieved * @param scope Scope to be searched (page, request, session, application) * or <code>null</code> to use <code>findAttribute()</code> instead * - * @exception IllegalArgumentException if an invalid scope name + * @exception JspException if an invalid scope name * is requested */ public static Object lookup(PageContext pageContext, String name, - String scope) { + String scope) throws JspException { Object bean = null; if (scope == null) @@ -146,8 +161,12 @@ else if (scope.equalsIgnoreCase("application")) bean = pageContext.getAttribute(name, PageContext.APPLICATION_SCOPE); - else - throw new IllegalArgumentException(scope); + else { + JspException e = new JspException + (messages.getMessage("lookup.scope", scope)); + saveException(pageContext, e); + throw e; + } return (bean); @@ -155,6 +174,64 @@ /** + * Locate and return the specified property of the specified bean, from + * an optionally specified scope, in the specified page context. If an + * exception is thrown, it will have already been saved via a call to + * <code>saveException()</code>. + * + * @param pageContext Page context to be searched + * @param name Name of the bean to be retrieved + * @param property Name of the property to be retrieved, or + * <code>null</code> to retrieve the bean itself + * @param scope Scope to be searched (page, request, session, application) + * or <code>null</code> to use <code>findAttribute()</code> instead + * + * @exception JspException if an invalid scope name + * is requested + * @exception JspException if the specified bean is not found + * @exception JspException if accessing this property causes an + * IllegalAccessException, IllegalArgumentException, + * InvocationTargetException, or NoSuchMethodException + */ + public static Object lookup(PageContext pageContext, String name, + String property, String scope) + throws JspException { + + // Look up the requested bean, and return if requested + Object bean = lookup(pageContext, name, scope); + if (property == null) + return (bean); + if (bean == null) { + JspException e = new JspException + (messages.getMessage("lookup.bean", name, scope)); + saveException(pageContext, e); + throw e; + } + + // Locate and return the specified property + try { + return (PropertyUtils.getProperty(bean, property)); + } catch (IllegalAccessException e) { + saveException(pageContext, e); + throw new JspException + (messages.getMessage("lookup.access", property, name)); + } catch (InvocationTargetException e) { + Throwable t = e.getTargetException(); + if (t == null) + t = e; + saveException(pageContext, t); + throw new JspException + (messages.getMessage("lookup.target", property, name)); + } catch (NoSuchMethodException e) { + saveException(pageContext, e); + throw new JspException + (messages.getMessage("lookup.method", property, name)); + } + + } + + + /** * Populate the properties of the specified JavaBean from the specified * HTTP request, based on matching each parameter name against the * corresponding JavaBeans "property setter" methods in the bean's class. @@ -334,6 +411,21 @@ } catch (Exception e) { throw new ServletException("BeanUtils.populate", e); } + + } + + + /** + * Save the specified exception as a request attribute for later use. + * + * @param pageContext The PageContext for the current page + * @param exception The exception to be saved + */ + public static void saveException(PageContext pageContext, + Throwable exception) { + + pageContext.setAttribute(Action.EXCEPTION_KEY, exception, + PageContext.REQUEST_SCOPE); } 1.2 +6 -6 jakarta-struts/src/share/org/apache/struts/util/ServletContextWriter.java Index: ServletContextWriter.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/ServletContextWriter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ServletContextWriter.java 2000/12/15 03:08:11 1.1 +++ ServletContextWriter.java 2001/02/12 00:32:14 1.2 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/ServletContextWriter.java,v 1.1 2000/12/15 03:08:11 craigmcc Exp $ - * $Revision: 1.1 $ - * $Date: 2000/12/15 03:08:11 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/ServletContextWriter.java,v 1.2 2001/02/12 00:32:14 craigmcc Exp $ + * $Revision: 1.2 $ + * $Date: 2001/02/12 00:32:14 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * 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 + * 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] @@ -76,7 +76,7 @@ * Along the way, carriage return characters are skipped. * * @author Craig R. McClanahan - * @version $Revision: 1.1 $ $Date: 2000/12/15 03:08:11 $ + * @version $Revision: 1.2 $ $Date: 2001/02/12 00:32:14 $ */ public class ServletContextWriter extends PrintWriter { 1.1 jakarta-struts/src/share/org/apache/struts/util/ResponseUtils.java Index: ResponseUtils.java =================================================================== /* * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/ResponseUtils.java,v 1.1 2001/02/12 00:32:14 craigmcc Exp $ * $Revision: 1.1 $ * $Date: 2001/02/12 00:32:14 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-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", "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 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/>. * */ package org.apache.struts.util; import java.io.IOException; import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.PageContext; import org.apache.struts.action.Action; /** * General purpose utility methods related to generating a servlet response * in the Struts controller framework. * * @author Craig R. McClanahan * @version $Revision: 1.1 $ $Date: 2001/02/12 00:32:14 $ */ public class ResponseUtils { // ------------------------------------------------------- Static Variables /** * The message resources for this package. */ protected static MessageResources messages = MessageResources.getMessageResources ("org.apache.struts.util.LocalStrings"); // --------------------------------------------------------- Public Methods /** * Filter the specified string for characters that are senstive to * HTML interpreters, returning the string with these characters replaced * by the corresponding character entities. * * @param value The string to be filtered and returned */ public static String filter(String value) { if (value == null) return (null); char content[] = new char[value.length()]; value.getChars(0, value.length(), content, 0); StringBuffer result = new StringBuffer(content.length + 50); for (int i = 0; i < content.length; i++) { switch (content[i]) { case '<': result.append("<"); break; case '>': result.append(">"); break; case '&': result.append("&"); break; case '"': result.append("""); break; default: result.append(content[i]); } } return (result.toString()); } /** * Write the specified text as the response to the writer associated with * this page. * * @param pageContext The PageContext object for this page * @param text The text to be written * * @exception JspException if an input/output error occurs (already saved) */ public static void write(PageContext pageContext, String text) throws JspException { JspWriter writer = pageContext.getOut(); try { writer.print(text); } catch (IOException e) { RequestUtils.saveException(pageContext, e); throw new JspException (messages.getMessage("write.io", e.toString())); } } }