cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java

2003-08-22 Thread dgraham
dgraham 2003/08/22 17:22:12

  Modified:src/share/org/apache/struts/taglib/html ErrorsTag.java
   src/share/org/apache/struts/taglib/logic
MessagesPresentTag.java
   src/share/org/apache/struts/taglib TagUtils.java
  Log:
  Deprecated TagUtils.getActionErrors() in favor of TagUtils.getActionMessages() which 
  now handles ActionErrors objects.
  
  Revision  ChangesPath
  1.30  +5 -5  
jakarta-struts/src/share/org/apache/struts/taglib/html/ErrorsTag.java
  
  Index: ErrorsTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ErrorsTag.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- ErrorsTag.java19 Aug 2003 23:36:54 -  1.29
  +++ ErrorsTag.java23 Aug 2003 00:22:12 -  1.30
  @@ -183,7 +183,7 @@
   // Were any error messages specified?
   ActionMessages errors = null;
   try {
  -errors = TagUtils.getInstance().getActionErrors(pageContext, name);
  +errors = TagUtils.getInstance().getActionMessages(pageContext, name);
   } catch (JspException e) {
   TagUtils.getInstance().saveException(pageContext, e);
   throw e;
  
  
  
  1.10  +2 -7  
jakarta-struts/src/share/org/apache/struts/taglib/logic/MessagesPresentTag.java
  
  Index: MessagesPresentTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/MessagesPresentTag.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- MessagesPresentTag.java   30 Jul 2003 23:55:50 -  1.9
  +++ MessagesPresentTag.java   23 Aug 2003 00:22:12 -  1.10
  @@ -127,12 +127,7 @@
   }
   
   try {
  -// Definitely know it should be an error so use method to retrieve 
errors.
  -if (Globals.ERROR_KEY.equals(name)) {
  -am = TagUtils.getInstance().getActionErrors(pageContext, name);
  -} else {
  -am = TagUtils.getInstance().getActionMessages(pageContext, name);
  -}
  +am = TagUtils.getInstance().getActionMessages(pageContext, name);
   
   } catch (JspException e) {
   TagUtils.getInstance().saveException(pageContext, e);
  
  
  
  1.25  +26 -10jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java
  
  Index: TagUtils.java
  ===
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- TagUtils.java 23 Aug 2003 00:12:40 -  1.24
  +++ TagUtils.java 23 Aug 2003 00:22:12 -  1.25
  @@ -629,6 +629,8 @@
* @param paramName Key for parameter value
* @return ActionErrors from request scope
* @exception JspException
  + * @deprecated Use getActionMessages() instead.  This will be removed
  + * after Struts 1.2.
*/
   public ActionErrors getActionErrors(PageContext pageContext, String paramName)
   throws JspException {
  @@ -649,7 +651,9 @@
   } else if (value instanceof String[]) {
   String keys[] = (String[]) value;
   for (int i = 0; i < keys.length; i++) {
  -errors.add(ActionMessages.GLOBAL_MESSAGE, new 
ActionMessage(keys[i]));
  +errors.add(
  +ActionMessages.GLOBAL_MESSAGE,
  +new ActionMessage(keys[i]));
   }
   
   } else if (value instanceof ActionErrors) {
  @@ -766,7 +770,9 @@
* @return ActionErrors in page context.
* @throws JspException
*/
  -public ActionMessages getActionMessages(PageContext pageContext, String 
paramName)
  +public ActionMessages getActionMessages(
  +PageContext pageContext,
  +String paramName)
   throws JspException {
   
   ActionMessages am = new ActionMessages();
  @@ -777,20 +783,30 @@
   if (value == null) {
   ;
   } else if (value instanceof String) {
  -am.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage((String) 
value));
  +am.add(
  +ActionMessages.GLOBAL_MESSAGE,
  +new ActionMessage((String) value));
   
   } else if (value instanceof String[]) {
   String keys[] = (String[]) value;
   for (int i = 0; i < keys.length; i++){
  -am.add(ActionMessages.GLOBAL_MESSAGE, new 
ActionMessage(keys[i]));
  +am.add(
  +Act

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java

2003-08-16 Thread dgraham
dgraham 2003/08/16 11:35:41

  Modified:src/share/org/apache/struts/taglib TagUtils.java
  Log:
  Replaced ActionError with ActionMessage.
  
  Revision  ChangesPath
  1.23  +6 -7  jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java
  
  Index: TagUtils.java
  ===
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- TagUtils.java 2 Aug 2003 22:19:37 -   1.22
  +++ TagUtils.java 16 Aug 2003 18:35:41 -  1.23
  @@ -83,7 +83,6 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.struts.Globals;
  -import org.apache.struts.action.ActionError;
   import org.apache.struts.action.ActionErrors;
   import org.apache.struts.action.ActionMessage;
   import org.apache.struts.action.ActionMessages;
  @@ -645,12 +644,12 @@
   } else if (value instanceof String) {
   errors.add(
   ActionErrors.GLOBAL_ERROR,
  -new ActionError((String) value));
  +new ActionMessage((String) value));
   
   } else if (value instanceof String[]) {
   String keys[] = (String[]) value;
   for (int i = 0; i < keys.length; i++) {
  -errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(keys[i]));
  +errors.add(ActionErrors.GLOBAL_ERROR, new 
ActionMessage(keys[i]));
   }
   
   } else if (value instanceof ActionErrors) {
  
  
  

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



cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java

2003-08-02 Thread dgraham
dgraham 2003/08/02 15:19:37

  Modified:src/share/org/apache/struts/util ModuleUtils.java
RequestUtils.java
   src/share/org/apache/struts/tiles
TilesUtilStrutsModulesImpl.java
   src/share/org/apache/struts/taglib TagUtils.java
  Log:
  Renamed ModuleUtils.getRequestModuleConfig() to getModuleConfig() to match
  other method names.
  
  Revision  ChangesPath
  1.3   +17 -17jakarta-struts/src/share/org/apache/struts/util/ModuleUtils.java
  
  Index: ModuleUtils.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/util/ModuleUtils.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ModuleUtils.java  2 Aug 2003 21:04:42 -   1.2
  +++ ModuleUtils.java  2 Aug 2003 22:19:37 -   1.3
  @@ -110,6 +110,22 @@
   protected ModuleUtils() {
   super();
   }
  +
  +/**
  + * Return the current ModuleConfig object stored in request, if it exists,
  + * null otherwise.
  + * This method can be used by plugin to retrieve the current module config
  + * object. If no moduleConfig is found, this means that the request haven't
  + * hit the server throught the struts servlet. The appropriate module config
  + * can be set and found with
  + * [EMAIL PROTECTED] RequestUtils#selectModule(HttpServletRequest, 
ServletContext)} .
  + * @param request The servlet request we are processing
  + * @return the ModuleConfig object from request, or null if none is set in
  + * the request.
  + */
  +public ModuleConfig getModuleConfig(HttpServletRequest request) {
  +return (ModuleConfig) request.getAttribute(Globals.MODULE_KEY);
  +}
   
   /**
* Return the ModuleConfig object is it exists, null otherwise.
  @@ -121,7 +137,7 @@
   HttpServletRequest request,
   ServletContext context) {
   
  -ModuleConfig moduleConfig = this.getRequestModuleConfig(request);
  +ModuleConfig moduleConfig = this.getModuleConfig(request);
   
   if (moduleConfig == null) {
   moduleConfig = (ModuleConfig) context.getAttribute(Globals.MODULE_KEY);
  @@ -201,22 +217,6 @@
*/
   public String[] getModulePrefixes(ServletContext context) {
   return (String[]) context.getAttribute(Globals.MODULE_PREFIXES_KEY);
  -}
  -
  -/**
  - * Return the current ModuleConfig object stored in request, if it exists,
  - * null otherwise.
  - * This method can be used by plugin to retrieve the current module config
  - * object. If no moduleConfig is found, this means that the request haven't
  - * hit the server throught the struts servlet. The appropriate module config
  - * can be set and found with
  - * [EMAIL PROTECTED] RequestUtils#selectModule(HttpServletRequest, 
ServletContext)} .
  - * @param request The servlet request we are processing
  - * @return the ModuleConfig object from request, or null if none is set in
  - * the request.
  - */
  -public ModuleConfig getRequestModuleConfig(HttpServletRequest request) {
  -return (ModuleConfig) request.getAttribute(Globals.MODULE_KEY);
   }
   
   /**
  
  
  
  1.134 +9 -9  
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.133
  retrieving revision 1.134
  diff -u -r1.133 -r1.134
  --- RequestUtils.java 2 Aug 2003 21:16:54 -   1.133
  +++ RequestUtils.java 2 Aug 2003 22:19:37 -   1.134
  @@ -900,7 +900,7 @@
   }
   
   ModuleConfig moduleConfig =
  -ModuleUtils.getInstance().getRequestModuleConfig(request);
  +ModuleUtils.getInstance().getModuleConfig(request);
   
   multipartClass = moduleConfig.getControllerConfig().getMultipartClass();
   
  @@ -1057,7 +1057,7 @@
   
   } else if (pattern.startsWith("*.")) {
   ModuleConfig appConfig =
  -ModuleUtils.getInstance().getRequestModuleConfig(request);
  +ModuleUtils.getInstance().getModuleConfig(request);
   sb.append(appConfig.getPrefix());
   sb.append(action.getPath());
   sb.append(pattern.substring(1));
  @@ -1127,7 +1127,7 @@
   
   // Calculate a context relative path for this ForwardConfig
   ModuleConfig moduleConfig =
  -ModuleUtils.getInstance().getRequestModuleConfig(request);
  +ModuleUtils.getInstance().getModuleConfig(request);
   String forwardPattern = 
moduleConfig.getControllerConfig().getForwardPattern();
   if (forwardPattern 

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java

2003-08-02 Thread dgraham
dgraham 2003/08/02 14:07:33

  Modified:src/share/org/apache/struts/taglib TagUtils.java
  Log:
  Replace RequestUtils calls with ModuleUtils.
  
  Revision  ChangesPath
  1.20  +9 -7  jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java
  
  Index: TagUtils.java
  ===
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- TagUtils.java 2 Aug 2003 20:40:18 -   1.19
  +++ TagUtils.java 2 Aug 2003 21:07:33 -   1.20
  @@ -91,6 +91,7 @@
   import org.apache.struts.config.ModuleConfig;
   import org.apache.struts.taglib.html.Constants;
   import org.apache.struts.util.MessageResources;
  +import org.apache.struts.util.ModuleUtils;
   import org.apache.struts.util.RequestUtils;
   
   /**
  @@ -167,6 +168,7 @@
   public static TagUtils getInstance() {
   return instance;
   }
  +
   /**
* Compute a set of query parameters that will be dynamically added to
* a generated URL.  The returned Map is keyed by parameter name, and the
  @@ -700,7 +702,7 @@
   
   HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
   StringBuffer value = new StringBuffer(request.getContextPath());
  -ModuleConfig config = RequestUtils.getRequestModuleConfig(request);
  +ModuleConfig config = 
ModuleUtils.getInstance().getRequestModuleConfig(request);
   
   if (config != null) {
   value.append(config.getPrefix());
  @@ -801,7 +803,7 @@
* @return the ModuleConfig object
*/
   public ModuleConfig getModuleConfig(PageContext pageContext) {
  -return RequestUtils.getModuleConfig(
  +return ModuleUtils.getInstance().getModuleConfig(
   (HttpServletRequest) pageContext.getRequest(),
   pageContext.getServletContext());
   }
  @@ -1025,7 +1027,7 @@
   public String pageURL(HttpServletRequest request, String page) {
   
   StringBuffer sb = new StringBuffer();
  -ModuleConfig moduleConfig = RequestUtils.getRequestModuleConfig(request);
  +ModuleConfig moduleConfig = 
ModuleUtils.getInstance().getRequestModuleConfig(request);
   String pagePattern = moduleConfig.getControllerConfig().getPagePattern();
   
   if (pagePattern == null) {
  
  
  

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



cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java

2003-08-02 Thread dgraham
dgraham 2003/08/02 13:40:18

  Modified:src/share/org/apache/struts/util RequestUtils.java
   src/share/org/apache/struts/taglib TagUtils.java
  Log:
  Moved pageURL() to TagUtils.
  
  Revision  ChangesPath
  1.131 +7 -43 
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.130
  retrieving revision 1.131
  diff -u -r1.130 -r1.131
  --- RequestUtils.java 2 Aug 2003 20:35:28 -   1.130
  +++ RequestUtils.java 2 Aug 2003 20:40:18 -   1.131
  @@ -61,11 +61,8 @@
   
   package org.apache.struts.util;
   
  -import java.lang.reflect.InvocationTargetException;
  -import java.lang.reflect.Method;
   import java.net.MalformedURLException;
   import java.net.URL;
  -import java.net.URLEncoder;
   import java.util.Collections;
   import java.util.Enumeration;
   import java.util.HashMap;
  @@ -1180,44 +1177,11 @@
*  (MUST start with a slash)
* @return context-relative URL
* @since Struts 1.1
  + * @deprecated Use TagUtils.pageURL() instead.  This will be removed
  + * after Struts 1.2.
*/
   public static String pageURL(HttpServletRequest request, String page) {
  -
  -StringBuffer sb = new StringBuffer();
  -ModuleConfig moduleConfig = getRequestModuleConfig(request);
  -String pagePattern = moduleConfig.getControllerConfig().getPagePattern();
  -if (pagePattern == null) {
  -sb.append(moduleConfig.getPrefix());
  -sb.append(page);
  -} else {
  -boolean dollar = false;
  -for (int i = 0; i < pagePattern.length(); i++) {
  -char ch = pagePattern.charAt(i);
  -if (dollar) {
  -switch (ch) {
  -case 'M' :
  -sb.append(moduleConfig.getPrefix());
  -break;
  -case 'P' :
  -sb.append(page);
  -break;
  -case '$' :
  -sb.append('$');
  -break;
  -default :
  -; // Silently swallow
  -}
  -dollar = false;
  -continue;
  -} else if (ch == '$') {
  -dollar = true;
  -} else {
  -sb.append(ch);
  -}
  -}
  -}
  -return (sb.toString());
  -
  +return TagUtils.getInstance().pageURL(request, page);
   }
   
   /**
  
  
  
  1.19  +60 -5 jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java
  
  Index: TagUtils.java
  ===
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- TagUtils.java 2 Aug 2003 20:35:28 -   1.18
  +++ TagUtils.java 2 Aug 2003 20:40:18 -   1.19
  @@ -438,7 +438,7 @@
   
   } else /* if (page != null) */ {
   url.append(request.getContextPath());
  -url.append(RequestUtils.pageURL(request, page));
  +url.append(this.pageURL(request, page));
   }
   
   // Add anchor if requested (replacing any existing anchor)
  @@ -1008,6 +1008,61 @@
   return resources.getMessage(userLocale, key, args);
   }
   
  +}
  +
  +/**
  + * Return the context-relative URL that corresponds to the specified
  + * page attribute value, calculated based on the
  + * pagePattern property of the current module's
  + * [EMAIL PROTECTED] ModuleConfig}.
  + *
  + * @param request The servlet request we are processing
  + * @param page The module-relative URL to be substituted in
  + * to the pagePattern pattern for the current module
  + * (MUST start with a slash)
  + * @return context-relative URL
  + */
  +public String pageURL(HttpServletRequest request, String page) {
  +
  +StringBuffer sb = new StringBuffer();
  +ModuleConfig moduleConfig = RequestUtils.getRequestModuleConfig(request);
  +String pagePattern = moduleConfig.getControllerConfig().getPagePattern();
  +
  +if (pagePattern == null) {
  +sb.append(moduleConfig.getPrefix());
  +sb.append(page);
  +
  +} else {
  +boolean dollar = false;
  +for (int i = 0; i < pagePattern.length(); i++) {
  +char ch = pagePattern.charAt(i);
  +if (dollar) {
  + 

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java

2003-08-02 Thread dgraham
dgraham 2003/08/02 13:35:28

  Modified:src/share/org/apache/struts/taglib/html ImgTag.java
   src/share/org/apache/struts/util RequestUtils.java
   src/share/org/apache/struts/taglib TagUtils.java
  Log:
  Moved encodeURL() to TagUtils.
  
  Revision  ChangesPath
  1.32  +7 -8  
jakarta-struts/src/share/org/apache/struts/taglib/html/ImgTag.java
  
  Index: ImgTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ImgTag.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- ImgTag.java   31 Jul 2003 00:19:04 -  1.31
  +++ ImgTag.java   2 Aug 2003 20:35:28 -   1.32
  @@ -72,7 +72,6 @@
   import org.apache.struts.config.ModuleConfig;
   import org.apache.struts.taglib.TagUtils;
   import org.apache.struts.util.MessageResources;
  -import org.apache.struts.util.RequestUtils;
   
   /**
* Generate an IMG tag to the specified image URI.
  @@ -615,7 +614,7 @@
   src.append('=');
   Object value = TagUtils.getInstance().lookup(pageContext, paramName, 
paramProperty, paramScope);
   if (value != null)
  -src.append(RequestUtils.encodeURL(value.toString()));
  +src.append(TagUtils.getInstance().encodeURL(value.toString()));
   }
   
   // Just return the URL if there is no bean to look up
  @@ -666,7 +665,7 @@
   }
   src.append(key);
   src.append('=');
  -src.append(RequestUtils.encodeURL(values[i]));
  +src.append(TagUtils.getInstance().encodeURL(values[i]));
   }
   } else {
   
  @@ -678,7 +677,7 @@
   }
   src.append(key);
   src.append('=');
  -src.append(RequestUtils.encodeURL(value.toString()));
  +src.append(TagUtils.getInstance().encodeURL(value.toString()));
   }
   }
   
  
  
  
  1.130 +7 -35 
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.129
  retrieving revision 1.130
  diff -u -r1.129 -r1.130
  --- RequestUtils.java 30 Jul 2003 23:55:50 -  1.129
  +++ RequestUtils.java 2 Aug 2003 20:35:28 -   1.130
  @@ -128,23 +128,6 @@
   private static MessageResources messages =
   MessageResources.getMessageResources("org.apache.struts.util.LocalStrings");
   
  -/**
  - * Java 1.4 encode method to use instead of deprecated 1.3 version.
  - */
  -private static Method encode = null;
  -
  -/**
  - * Initialize the encode variable with the 1.4 method if available.
  - */
  -static {
  -try {
  -// get version of encode method with two String args 
  -Class[] args = new Class[] { String.class, String.class };
  -encode = URLEncoder.class.getMethod("encode", args);
  -} catch (NoSuchMethodException e) {
  -log.debug("Could not find Java 1.4 encode method.  Using deprecated 
version.", e);
  -}
  -}
   
   // - Public Methods
   
  @@ -1505,22 +1488,11 @@
* method; if the reflection operations throw exceptions, this will return the 
url
* encoded with the old URLEncoder.encode() method.
* @return String - the encoded url.
  + * @deprecated Use TagUtils.encodeURL() instead.  This will be removed
  + * after Struts 1.2.
*/
   public static String encodeURL(String url) {
  -try {
  -
  -// encode url with new 1.4 method and UTF-8 encoding
  -if (encode != null) {
  -return (String) encode.invoke(null, new Object[] { url, "UTF-8" });
  -}
  -
  -} catch (IllegalAccessException e) {
  -log.debug("Could not find Java 1.4 encode method.  Using deprecated 
version.", e);
  -} catch (InvocationTargetException e) {
  -log.debug("Could not find Java 1.4 encode method. Using deprecated 
version.", e);
  -}
  -
  -return URLEncoder.encode(url);
  +return TagUtils.getInstance().encodeURL(url);
   }
   
   /**
  
  
  
  1.18  +55 -14jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java
  
  Index: TagUtils.java
  ===
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- TagUtils.java 31 Jul 2003 00:

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java

2003-07-30 Thread dgraham
dgraham 2003/07/30 17:30:21

  Modified:src/share/org/apache/struts/util ResponseUtils.java
   src/share/org/apache/struts/taglib TagUtils.java
  Log:
  Moved filter() method to TagUtils.  ResponseUtils doesn't have any
  methods left.
  
  Revision  ChangesPath
  1.8   +11 -43
jakarta-struts/src/share/org/apache/struts/util/ResponseUtils.java
  
  Index: ResponseUtils.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/util/ResponseUtils.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ResponseUtils.java31 Jul 2003 00:19:04 -  1.7
  +++ ResponseUtils.java31 Jul 2003 00:30:21 -  1.8
  @@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -59,24 +59,22 @@
*
*/
   
  -
   package org.apache.struts.util;
   
  -
   import javax.servlet.jsp.JspException;
   import javax.servlet.jsp.PageContext;
   
   import org.apache.struts.taglib.TagUtils;
   
  -
   /**
* General purpose utility methods related to generating a servlet response
* in the Struts controller framework.
*
* @author Craig R. McClanahan
* @version $Revision$ $Date$
  + * @deprecated Use the corresponding TagUtils methods instead.  
  + * This class will be removed after Struts 1.2.
*/
  -
   public class ResponseUtils {
   
   
  @@ -101,38 +99,10 @@
* by the corresponding character entities.
*
* @param value The string to be filtered and returned
  + * @deprecated
*/
   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;
  -case '\'':
  -result.append("'");
  -break;
  -default:
  -result.append(content[i]);
  -}
  -}
  -return (result.toString());
  -
  +return TagUtils.getInstance().filter(value);
   }
   
   
  @@ -147,8 +117,7 @@
* @param text The text to be written
*
* @exception JspException if an input/output error occurs (already saved)
  - * @deprecated Use TagUtils.write() instead.  This will be 
  - * removed after Struts 1.2.
  + * @deprecated
*/
   public static void write(PageContext pageContext, String text)
   throws JspException {
  @@ -166,8 +135,7 @@
* @param text The text to be written
*
* @exception JspException if an input/output error occurs (already saved)
  - * @deprecated Use TagUtils.writePrevious() instead.  This will be 
  - * removed after Struts 1.2.
  + * @deprecated
*/
   public static void writePrevious(PageContext pageContext, String text)
   throws JspException {
  
  
  
  1.17  +46 -4 jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java
  
  Index: TagUtils.java
  ===
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- TagUtils.java 31 Jul 2003 00:19:04 -  1.16
  +++ TagUtils.java 31 Jul 2003 00:30:21 -  1.17
  @@ -531,6 +531,48 @@
}
   
   }
  +
  +/**
  + * 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 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])

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java

2003-07-30 Thread dgraham
dgraham 2003/07/30 17:19:04

  Modified:src/share/org/apache/struts/taglib/html SubmitTag.java
CancelTag.java CheckboxTag.java ResetTag.java
ButtonTag.java RadioTag.java HtmlTag.java
MessagesTag.java OptionTag.java ImageTag.java
LinkTag.java ImgTag.java SelectTag.java
MultiboxTag.java OptionsTag.java
   src/share/org/apache/struts/taglib/nested NestedRootTag.java
NestedPropertyTag.java
   src/share/org/apache/struts/util ResponseUtils.java
   src/share/org/apache/struts/taglib/logic IterateTag.java
   src/share/org/apache/struts/taglib TagUtils.java
  Log:
  Moved ResponseUtils methods to TagUtils.
  
  Revision  ChangesPath
  1.18  +7 -11 
jakarta-struts/src/share/org/apache/struts/taglib/html/SubmitTag.java
  
  Index: SubmitTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/SubmitTag.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- SubmitTag.java19 Mar 2003 18:29:54 -  1.17
  +++ SubmitTag.java31 Jul 2003 00:19:04 -  1.18
  @@ -59,13 +59,12 @@
*
*/
   
  -
   package org.apache.struts.taglib.html;
   
  -
   import javax.servlet.jsp.JspException;
  +
  +import org.apache.struts.taglib.TagUtils;
   import org.apache.struts.util.MessageResources;
  -import org.apache.struts.util.ResponseUtils;
   
   /**
* Tag for input fields of type "submit".
  @@ -73,7 +72,6 @@
* @author Craig R. McClanahan
* @version $Revision$ $Date$
*/
  -
   public class SubmitTag extends BaseHandlerTag {
   
   
  @@ -236,10 +234,8 @@
   results.append(prepareStyles());
   results.append(getElementClose());
   
  -// Render this element to our writer
  -ResponseUtils.write(pageContext, results.toString());
  +TagUtils.getInstance().write(pageContext, results.toString());
   
  -// Evaluate the remainder of this page
   return (EVAL_PAGE);
   
   }
  
  
  
  1.13  +8 -7  
jakarta-struts/src/share/org/apache/struts/taglib/html/CancelTag.java
  
  Index: CancelTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/CancelTag.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- CancelTag.java22 Dec 2002 04:55:30 -  1.12
  +++ CancelTag.java31 Jul 2003 00:19:04 -  1.13
  @@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -64,8 +64,9 @@
   
   
   import javax.servlet.jsp.JspException;
  +
  +import org.apache.struts.taglib.TagUtils;
   import org.apache.struts.util.MessageResources;
  -import org.apache.struts.util.ResponseUtils;
   
   
   /**
  @@ -219,7 +220,7 @@
   results.append(getElementClose());
   
   // Render this element to our writer
  -ResponseUtils.write(pageContext, results.toString());
  +TagUtils.getInstance().write(pageContext, results.toString());
   
   // Evaluate the remainder of this page
   return (EVAL_PAGE);
  
  
  
  1.19  +40 -45
jakarta-struts/src/share/org/apache/struts/taglib/html/CheckboxTag.java
  
  Index: CheckboxTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/CheckboxTag.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- CheckboxTag.java  26 Jul 2003 17:22:27 -  1.18
  +++ CheckboxTag.java  31 Jul 2003 00:19:04 -  1.19
  @@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -59,16 +59,12 @@
*
*/
   
  -
   package org.apache.struts.taglib.html;
   
  -
   import javax.servlet.jsp.JspException;
  -import org.apache.struts.util.MessageResources;
  -import org.apache.struts.util.RequestUtils;
  -import org.apache.struts.util.ResponseUtils;
  -import org.apache.struts.taglib.TagUtils;
   
  +import org.apache.struts.taglib.TagUtils;
  +import org.apache.struts.util.MessageResources;
   
   /**
* Tag for input fields of type "checkbox".
  @@ -76,19 +72,15 @@
* @author Craig R. McClanahan
* @version $Revision$

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java

2003-07-26 Thread rleland
rleland 2003/07/26 23:25:41

  Modified:src/share/org/apache/struts/taglib TagUtils.java
  Log:
  Move computeURL() to Tagutils
  
  Revision  ChangesPath
  1.14  +253 -4jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java
  
  Index: TagUtils.java
  ===
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- TagUtils.java 26 Jul 2003 19:04:07 -  1.13
  +++ TagUtils.java 27 Jul 2003 06:25:41 -  1.14
  @@ -64,10 +64,13 @@
   import java.util.HashMap;
   import java.util.Locale;
   import java.util.Map;
  +import java.util.Iterator;
   import java.lang.reflect.InvocationTargetException;
  +import java.net.MalformedURLException;
   
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpSession;
  +import javax.servlet.http.HttpServletResponse;
   import javax.servlet.jsp.JspException;
   import javax.servlet.jsp.PageContext;
   
  @@ -77,6 +80,7 @@
   import org.apache.struts.action.ActionError;
   import org.apache.struts.action.ActionErrors;
   import org.apache.struts.config.ModuleConfig;
  +import org.apache.struts.config.ForwardConfig;
   import org.apache.struts.util.MessageResources;
   import org.apache.struts.util.RequestUtils;
   import org.apache.struts.Globals;
  @@ -275,6 +279,251 @@
   
   // Return the completed Map
   return (results);
  +
  +}
  +/**
  + * Compute a hyperlink URL based on the forward,
  + * href, action or page parameter
  + * that is not null.
  + * The returned URL will have already been passed to
  + * response.encodeURL() for adding a session identifier.
  + *
  + * @param pageContext PageContext for the tag making this call
  + *
  + * @param forward Logical forward name for which to look up
  + *  the context-relative URI (if specified)
  + * @param href URL to be utilized unmodified (if specified)
  + * @param page Module-relative page for which a URL should
  + *  be created (if specified)
  + * @param action Logical action name for which to look up
  + *  the context-relative URI (if specified)
  + *
  + * @param params Map of parameters to be dynamically included (if any)
  + * @param anchor Anchor to be dynamically included (if any)
  + *
  + * @param redirect Is this URL for a response.sendRedirect()?
  + * @return URL with session identifier
  + * @exception java.net.MalformedURLException if a URL cannot be created
  + *  for the specified parameters
  + */
  +public String computeURL(
  +PageContext pageContext,
  +String forward,
  +String href,
  +String page,
  +String action,
  +Map params,
  +String anchor,
  +boolean redirect)
  +throws MalformedURLException {
  +
  +return computeURL(
  +pageContext,
  +forward,
  +href,
  +page,
  +action,
  +params,
  +anchor,
  +redirect,
  +true);
  +}
  +
  +/**
  + * Compute a hyperlink URL based on the forward,
  + * href, action or page parameter
  + * that is not null.
  + * The returned URL will have already been passed to
  + * response.encodeURL() for adding a session identifier.
  + *
  + * @param pageContext PageContext for the tag making this call
  + *
  + * @param forward Logical forward name for which to look up
  + *  the context-relative URI (if specified)
  + * @param href URL to be utilized unmodified (if specified)
  + * @param page Module-relative page for which a URL should
  + *  be created (if specified)
  + * @param action Logical action name for which to look up
  + *  the context-relative URI (if specified)
  + *
  + * @param params Map of parameters to be dynamically included (if any)
  + * @param anchor Anchor to be dynamically included (if any)
  + *
  + * @param redirect Is this URL for a response.sendRedirect()?
  + * @param encodeSeparator This is only checked if redirect is set to false 
(never
  + * encoded for a redirect).  If true, query string parameter separators are 
encoded
  + * as >amp;, else & is used.
  + * @return URL with session identifier
  + * @exception java.net.MalformedURLException if a URL cannot be created
  + *  for the specified parameters
  + */
  +public String computeURL(
  +PageContext pageContext,
  +String forward,
  +String href,
  +String page,
  +String action,
  +Map params,
  +String anchor,
  +boolean redirect,
  +boolean encodeSeparator)
  +throws MalformedURLException {
  +
  +// T

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java

2003-07-26 Thread dgraham
dgraham 2003/07/26 12:04:07

  Modified:src/share/org/apache/struts/util RequestUtils.java
   src/share/org/apache/struts/taglib TagUtils.java
  Log:
  Moved other message() method to TagUtils.
  
  Revision  ChangesPath
  1.126 +12 -7 
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.125
  retrieving revision 1.126
  diff -u -r1.125 -r1.126
  --- RequestUtils.java 26 Jul 2003 18:58:36 -  1.125
  +++ RequestUtils.java 26 Jul 2003 19:04:07 -  1.126
  @@ -825,12 +825,17 @@
*
* @exception JspException if a lookup error occurs (will have been
*  saved in the request already)
  + * @deprecated Use TagUtils.message() instead.  This will be removed after
  + * Struts 1.2.
*/
  -public static String message(PageContext pageContext, String bundle, String 
locale, String key)
  +public static String message(
  +PageContext pageContext,
  +String bundle,
  +String locale,
  +String key)
   throws JspException {
   
  -return (message(pageContext, bundle, locale, key, null));
  -
  +return TagUtils.getInstance().message(pageContext, bundle, locale, key);
   }
   
   /**
  
  
  
  1.13  +28 -4 jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java
  
  Index: TagUtils.java
  ===
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- TagUtils.java 26 Jul 2003 19:01:12 -  1.12
  +++ TagUtils.java 26 Jul 2003 19:04:07 -  1.13
  @@ -578,6 +578,30 @@
*  message resources bundle
* @param locale Name of the session attribute for our user's Locale
* @param key Message key to be looked up and returned
  + * @return message string
  + *
  + * @exception JspException if a lookup error occurs (will have been
  + *  saved in the request already)
  + */
  +public String message(
  +PageContext pageContext,
  +String bundle,
  +String locale,
  +String key)
  +throws JspException {
  +
  +return message(pageContext, bundle, locale, key, null);
  +
  +}
  +
  +/**
  + * Look up and return a message string, based on the specified parameters.
  + *
  + * @param pageContext The PageContext associated with this request
  + * @param bundle Name of the servlet context attribute for our
  + *  message resources bundle
  + * @param locale Name of the session attribute for our user's Locale
  + * @param key Message key to be looked up and returned
* @param args Replacement parameters for this message
* @return message string
* @exception JspException if a lookup error occurs (will have been
  
  
  

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



cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java

2003-07-26 Thread dgraham
dgraham 2003/07/26 12:01:12

  Modified:src/share/org/apache/struts/taglib TagUtils.java
  Log:
  Simplified return logic in getActionMappingName().
  
  Revision  ChangesPath
  1.12  +8 -12 jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java
  
  Index: TagUtils.java
  ===
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TagUtils.java 26 Jul 2003 18:58:37 -  1.11
  +++ TagUtils.java 26 Jul 2003 19:01:12 -  1.12
  @@ -353,11 +353,7 @@
   value = value.substring(0, period);
   }
   
  -if (value.startsWith("/")) {
  -return (value);
  -} else {
  -return ("/" + value);
  -}
  +return value.startsWith("/") ? value : ("/" + value);
   }
   
   /**
  @@ -601,9 +597,9 @@
   Locale userLocale = getUserLocale(pageContext, locale);
   
   if (args == null) {
  -return (resources.getMessage(userLocale, key));
  +return resources.getMessage(userLocale, key);
   } else {
  -return (resources.getMessage(userLocale, key, args));
  +return resources.getMessage(userLocale, key, args);
   }
   
   }
  @@ -633,7 +629,7 @@
   
   Locale userLocale = getUserLocale(pageContext, locale);
   
  -return (resources.isPresent(userLocale, key));
  +return resources.isPresent(userLocale, key);
   }
   
   /**
  
  
  

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



cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java

2003-07-26 Thread dgraham
dgraham 2003/07/26 11:58:37

  Modified:src/share/org/apache/struts/taglib/html ErrorsTag.java
   src/share/org/apache/struts/util RequestUtils.java
   src/share/org/apache/struts/taglib TagUtils.java
  Log:
  Moved present() and message() to TagUtils.
  
  Revision  ChangesPath
  1.24  +8 -8  
jakarta-struts/src/share/org/apache/struts/taglib/html/ErrorsTag.java
  
  Index: ErrorsTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ErrorsTag.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- ErrorsTag.java26 Jul 2003 01:00:01 -  1.23
  +++ ErrorsTag.java26 Jul 2003 18:58:36 -  1.24
  @@ -196,16 +196,16 @@
   }
   
   boolean headerPresent =
  -RequestUtils.present(pageContext, bundle, locale, "errors.header");
  +TagUtils.getInstance().present(pageContext, bundle, locale, 
"errors.header");
   
   boolean footerPresent =
  -RequestUtils.present(pageContext, bundle, locale, "errors.footer");
  +TagUtils.getInstance().present(pageContext, bundle, locale, 
"errors.footer");
   
   boolean prefixPresent =
  -RequestUtils.present(pageContext, bundle, locale, "errors.prefix");
  +TagUtils.getInstance().present(pageContext, bundle, locale, 
"errors.prefix");
   
   boolean suffixPresent =
  -RequestUtils.present(pageContext, bundle, locale, "errors.suffix");
  +TagUtils.getInstance().present(pageContext, bundle, locale, 
"errors.suffix");
   
   // Render the error messages appropriately
   StringBuffer results = new StringBuffer();
  
  
  
  1.125 +15 -75
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.124
  retrieving revision 1.125
  diff -u -r1.124 -r1.125
  --- RequestUtils.java 26 Jul 2003 18:51:37 -  1.124
  +++ RequestUtils.java 26 Jul 2003 18:58:36 -  1.125
  @@ -845,6 +845,8 @@
* @return message string
* @exception JspException if a lookup error occurs (will have been
*  saved in the request already)
  + * @deprecated Use TagUtils.message() instead.  This will be removed after
  + * Struts 1.2.
*/
   public static String message(
   PageContext pageContext,
  @@ -854,71 +856,12 @@
   Object args[])
   throws JspException {
   
  -MessageResources resources =
  -retrieveMessageResources(pageContext, bundle, false);
  -
  -Locale userLocale = retrieveUserLocale(pageContext, locale);
  -
  -if (args == null) {
  -return (resources.getMessage(userLocale, key));
  -} else {
  -return (resources.getMessage(userLocale, key, args));
  -}
  -
  -}
  -
  -/**
  - * Returns the appropriate MessageResources object for the current module and 
  - * the given bundle.
  - * 
  - * @param pageContext Search the context's scopes for the resources.
  - * @param bundle The bundle name to look for.  If this is null, 
the 
  - * default bundle name is used.
  - * @return MessageResources The bundle's resources stored in some scope. 
  - * @throws JspException if the MessageResources object could not be found.
  - */
  -private static MessageResources retrieveMessageResources(
  -PageContext pageContext,
  -String bundle,
  -boolean checkPageScope)
  -throws JspException {
  -
  -MessageResources resources = null;
  -
  -if (bundle == null) {
  -bundle = Globals.MESSAGES_KEY;
  -}
  -
  -if (checkPageScope) {
  -resources =
  -(MessageResources) pageContext.getAttribute(
  -bundle,
  -PageContext.PAGE_SCOPE);
  -}
  -
  -if (resources == null) {
  -resources =
  -(MessageResources) pageContext.getAttribute(
  -bundle,
  -PageContext.REQUEST_SCOPE);
  -}
  -
  -if (resources == null) {
  -ModuleConfig config = getModuleConfig(pageContext);
  -resources =
  -(MessageResources) pageContext.getAttribute(
  -bundle + config.getPrefix(),
  -PageContext.APPLICATION_SCOPE);
  -}
  -
  -if (resources == null) {
  -JspException e =
  -new JspException(messages.getMessage("message.bundle", bundle));
  -saveException(pageContext, e);
  -throw e;

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java

2003-07-26 Thread dgraham
dgraham 2003/07/26 11:51:37

  Modified:src/share/org/apache/struts/taglib/html BaseHandlerTag.java
JavascriptValidatorTag.java FormTag.java
   src/share/org/apache/struts/util RequestUtils.java
   src/share/org/apache/struts/taglib TagUtils.java
  Log:
  Moved isXhtml to TagUtils.
  
  Revision  ChangesPath
  1.30  +6 -6  
jakarta-struts/src/share/org/apache/struts/taglib/html/BaseHandlerTag.java
  
  Index: BaseHandlerTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/BaseHandlerTag.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- BaseHandlerTag.java   26 Jul 2003 17:22:27 -  1.29
  +++ BaseHandlerTag.java   26 Jul 2003 18:51:34 -  1.30
  @@ -72,8 +72,8 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.struts.Globals;
  -import org.apache.struts.taglib.logic.IterateTag;
   import org.apache.struts.taglib.TagUtils;
  +import org.apache.struts.taglib.logic.IterateTag;
   import org.apache.struts.util.MessageResources;
   import org.apache.struts.util.RequestUtils;
   
  @@ -879,7 +879,7 @@
* @since Struts 1.1
*/
   protected boolean isXhtml() {
  -return RequestUtils.isXhtml(this.pageContext);
  +return TagUtils.getInstance().isXhtml(this.pageContext);
   }
   
   /**
  
  
  
  1.35  +5 -6  
jakarta-struts/src/share/org/apache/struts/taglib/html/JavascriptValidatorTag.java
  
  Index: JavascriptValidatorTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/JavascriptValidatorTag.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- JavascriptValidatorTag.java   26 Jul 2003 01:22:30 -  1.34
  +++ JavascriptValidatorTag.java   26 Jul 2003 18:51:35 -  1.35
  @@ -84,7 +84,6 @@
   import org.apache.struts.config.ModuleConfig;
   import org.apache.struts.taglib.TagUtils;
   import org.apache.struts.util.MessageResources;
  -import org.apache.struts.util.RequestUtils;
   import org.apache.struts.validator.Resources;
   import org.apache.struts.validator.ValidatorPlugIn;
   
  @@ -770,7 +769,7 @@
* Returns true if this is an xhtml page.
*/
   private boolean isXhtml() {
  -return RequestUtils.isXhtml(this.pageContext);
  +return TagUtils.getInstance().isXhtml(this.pageContext);
   }
   
   /**
  
  
  
  1.53  +5 -5  
jakarta-struts/src/share/org/apache/struts/taglib/html/FormTag.java
  
  Index: FormTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/FormTag.java,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- FormTag.java  26 Jul 2003 18:44:53 -  1.52
  +++ FormTag.java  26 Jul 2003 18:51:36 -  1.53
  @@ -854,7 +854,7 @@
* Returns true if this tag should render as xhtml.
*/
   private boolean isXhtml() {
  -return RequestUtils.isXhtml(this.pageContext);
  +return TagUtils.getInstance().isXhtml(this.pageContext);
   }
   
   /**
  
  
  
  1.124 +6 -4  
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.123
  retrieving revision 1.124
  diff -u -r1.123 -r1.124
  --- RequestUtils.java 26 Jul 2003 18:45:24 -  1.123
  +++ RequestUtils.java 26 Jul 2003 18:51:37 -  1.124
  @@ -1752,6 +1752,8 @@
   /**
* Returns true if the custom tags are in XHTML mode.
* @since Struts 1.1
  + * @deprecated Use TagUtils.isXhtml() instead.  This will be removed after
  + * Struts 1.2.
*/
   public static boolean isXhtml(PageContext pageContext) {
   String xhtml =
  
  
  
  1.10  +16 -4 jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java
  
  Index: TagUtils.java
  ===
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TagUtils.java 26 Jul 2003 18:44:54 -  1.9
  +++ TagUtils.java 26 Jul 2003 18:51:37 -  1.10
  @@ -458,6 +458,18 @@
   (HttpServletRequest) pageContext.getRequest(),
   locale);
   }
  +
  +/**
  + * Returns true if the custom tags are in XHTML mode.
  + */
  +public boolean isXhtml(Pag

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java

2003-07-26 Thread dgraham
dgraham 2003/07/26 11:44:54

  Modified:src/share/org/apache/struts/taglib/html FormTag.java
   src/share/org/apache/struts/util RequestUtils.java
   src/share/org/apache/struts/taglib TagUtils.java
  Log:
  Moved RequestUtils.getActionMappingURL() and .getActionMappingName()
  to TagUtils.
  
  Revision  ChangesPath
  1.52  +8 -6  
jakarta-struts/src/share/org/apache/struts/taglib/html/FormTag.java
  
  Index: FormTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/FormTag.java,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- FormTag.java  26 Jul 2003 01:22:30 -  1.51
  +++ FormTag.java  26 Jul 2003 18:44:53 -  1.52
  @@ -593,7 +593,9 @@
   results.append("\" action=\"");
   results.append(
   response.encodeURL(
  -RequestUtils.getActionMappingURL(this.action, this.pageContext)));
  +TagUtils.getInstance().getActionMappingURL(
  +this.action,
  +this.pageContext)));
   
   results.append("\"");
   
  @@ -812,7 +814,7 @@
   Globals.ACTION_SERVLET_KEY);
   
   // Look up the action mapping we will be submitting to
  -String mappingName = RequestUtils.getActionMappingName(action);
  +String mappingName = TagUtils.getInstance().getActionMappingName(action);
   mapping = (ActionMapping) moduleConfig.findActionConfig(mappingName);
   if (mapping == null) {
   JspException e = new 
JspException(messages.getMessage("formTag.mapping", mappingName));
  
  
  
  1.122 +15 -65
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.121
  retrieving revision 1.122
  diff -u -r1.121 -r1.122
  --- RequestUtils.java 26 Jul 2003 17:39:33 -  1.121
  +++ RequestUtils.java 26 Jul 2003 18:44:54 -  1.122
  @@ -558,74 +558,24 @@
* If the resulting value does not start with a slash, then a
* slash is prepended.
* 
  + * @deprecated Use TagUtils.getActionMappingName() instead.  This will be 
  + * removed after Struts 1.2.
*/
   public static String getActionMappingName(String action) {
  -
  -String value = action;
  -int question = action.indexOf("?");
  -if (question >= 0) {
  -value = value.substring(0, question);
  -}
  -int slash = value.lastIndexOf("/");
  -int period = value.lastIndexOf(".");
  -if ((period >= 0) && (period > slash)) {
  -value = value.substring(0, period);
  -}
  -if (value.startsWith("/")) {
  -return (value);
  -} else {
  -return ("/" + value);
  -}
  +return TagUtils.getInstance().getActionMappingName(action);
   }
   
   /**
* Return the form action converted into a server-relative URL.
  + * @deprecated Use TagUtils.getActionMappingURL() instead.  This will be 
  + * removed after Struts 1.2.
*/
  -public static String getActionMappingURL(String action, PageContext 
pageContext) {
  -
  -HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
  -StringBuffer value = new StringBuffer(request.getContextPath());
  -ModuleConfig config = getRequestModuleConfig(request);
  -if (config != null) {
  -value.append(config.getPrefix());
  -}
  -
  -// Use our servlet mapping, if one is specified
  -String servletMapping =
  -(String) pageContext.getAttribute(Globals.SERVLET_KEY, 
PageContext.APPLICATION_SCOPE);
  -if (servletMapping != null) {
  -String queryString = null;
  -int question = action.indexOf("?");
  -if (question >= 0) {
  -queryString = action.substring(question);
  -}
  -String actionMapping = getActionMappingName(action);
  -if (servletMapping.startsWith("*.")) {
  -value.append(actionMapping);
  -value.append(servletMapping.substring(1));
  -} else if (servletMapping.endsWith("/*")) {
  -value.append(servletMapping.substring(0, servletMapping.length() - 
2));
  -value.append(actionMapping);
  -} else if (servletMapping.equals("/")) {
  -value.append(actionMapping);
  -}
  -if (queryString != null) {
  -value.append(queryString);
  -}
  -}
  -
  -// Otherwise,

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java

2003-07-26 Thread dgraham
dgraham 2003/07/26 11:28:03

  Modified:src/share/org/apache/struts/taglib TagUtils.java
  Log:
  Removed static modifier from methods ported from RequestUtils.  Also
  removed @since tags from individual methods because this whole class
  is @since Struts 1.2.
  
  Revision  ChangesPath
  1.8   +12 -10jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java
  
  Index: TagUtils.java
  ===
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TagUtils.java 26 Jul 2003 17:40:20 -  1.7
  +++ TagUtils.java 26 Jul 2003 18:28:03 -  1.8
  @@ -171,7 +171,7 @@
* @exception JspException if a class cast exception occurs on a
*  looked-up bean or property
*/
  -public static Map computeParameters(
  +public Map computeParameters(
   PageContext pageContext,
   String paramId,
   String paramName,
  @@ -373,7 +373,7 @@
* @exception JspException if an invalid scope name
*  is requested
*/
  -public static Object lookup(PageContext pageContext, String name, String 
scopeName)
  +public Object lookup(PageContext pageContext, String name, String scopeName)
   throws JspException {
   
   if (scopeName == null) {
  @@ -409,9 +409,8 @@
* @exception JspException if accessing this property causes an
*  IllegalAccessException, IllegalArgumentException,
*  InvocationTargetException, or NoSuchMethodException
  - * @since Struts 1.2
*/
  -public static Object lookup(
  +public Object lookup(
   PageContext pageContext,
   String name,
   String property,
  @@ -464,9 +463,12 @@
* @param pageContext The PageContext for the current page
* @param exception The exception to be saved
*/
  -public static void saveException(PageContext pageContext, Throwable exception) {
  +public void saveException(PageContext pageContext, Throwable exception) {
   
  -pageContext.setAttribute(Globals.EXCEPTION_KEY, exception, 
PageContext.REQUEST_SCOPE);
  +pageContext.setAttribute(
  +Globals.EXCEPTION_KEY,
  +exception,
  +PageContext.REQUEST_SCOPE);
   
   }
   
  
  
  

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



cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java

2003-07-26 Thread rleland
rleland 2003/07/26 10:40:21

  Modified:src/share/org/apache/struts/taglib TagUtils.java
  Log:
  Move RequestUtils.computeParameters() to
  this class
  
  Revision  ChangesPath
  1.7   +137 -9jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java
  
  Index: TagUtils.java
  ===
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TagUtils.java 26 Jul 2003 17:22:27 -  1.6
  +++ TagUtils.java 26 Jul 2003 17:40:20 -  1.7
  @@ -67,6 +67,7 @@
   import java.lang.reflect.InvocationTargetException;
   
   import javax.servlet.http.HttpServletRequest;
  +import javax.servlet.http.HttpSession;
   import javax.servlet.jsp.JspException;
   import javax.servlet.jsp.PageContext;
   
  @@ -79,14 +80,16 @@
   import org.apache.struts.util.MessageResources;
   import org.apache.struts.util.RequestUtils;
   import org.apache.struts.Globals;
  +import org.apache.struts.taglib.html.Constants;
   
   /**
* Provides helper methods for JSP tags.
  - * 
  + *
* @author Craig R. McClanahan
* @author Ted Husted
* @author James Turner
* @author David Graham
  + * @author Rob Leland
* @version $Revision$
* @since Struts 1.2
*/
  @@ -110,8 +113,8 @@
   MessageResources.getMessageResources("org.apache.struts.util.LocalStrings");
   
   /**
  - * Maps lowercase JSP scope names to their PageContext integer constant 
  - * values. 
  + * Maps lowercase JSP scope names to their PageContext integer constant
  + * values.
*/
   private static final Map scopes = new HashMap();
   
  @@ -138,9 +141,134 @@
   public static TagUtils getInstance() {
   return instance;
   }
  +/**
  + * Compute a set of query parameters that will be dynamically added to
  + * a generated URL.  The returned Map is keyed by parameter name, and the
  + * values are either null (no value specified), a String (single value
  + * specified), or a String[] array (multiple values specified).  Parameter
  + * names correspond to the corresponding attributes of the
  + *  tag.  If no query parameters are
  + * identified, return null.
  + *
  + * @param pageContext PageContext we are operating in
  +
  + * @param paramId Single-value request parameter name (if any)
  + * @param paramName Bean containing single-value parameter value
  + * @param paramProperty Property (of bean named by paramName
  + *  containing single-value parameter value
  + * @param paramScope Scope containing bean named by
  + *  paramName
  + *
  + * @param name Bean containing multi-value parameters Map (if any)
  + * @param property Property (of bean named by name
  + *  containing multi-value parameters Map
  + * @param scope Scope containing bean named by
  + *  name
  + *
  + * @param transaction Should we add our transaction control token?
  + * @return Map of query parameters
  + * @exception JspException if we cannot look up the required beans
  + * @exception JspException if a class cast exception occurs on a
  + *  looked-up bean or property
  + */
  +public static Map computeParameters(
  +PageContext pageContext,
  +String paramId,
  +String paramName,
  +String paramProperty,
  +String paramScope,
  +String name,
  +String property,
  +String scope,
  +boolean transaction)
  +throws JspException {
  +
  +// Short circuit if no parameters are specified
  +if ((paramId == null) && (name == null) && !transaction) {
  +return (null);
  +}
  +
  +// Locate the Map containing our multi-value parameters map
  +Map map = null;
  +try {
  +if (name != null) {
  +map = (Map) TagUtils.getInstance().lookup(pageContext, name, 
property, scope);
  +}
  +} catch (ClassCastException e) {
  +saveException(pageContext, e);
  +throw new JspException(messages.getMessage("parameters.multi", name, 
property, scope));
  +} catch (JspException e) {
  +saveException(pageContext, e);
  +throw e;
  +}
  +
  +// Create a Map to contain our results from the multi-value parameters
  +Map results = null;
  +if (map != null) {
  +results = new HashMap(map);
  +} else {
  +results = new HashMap();
  +}
  +
  +// Add the single-value parameter (if any)
  +if ((paramId != null) && (paramName != null)) {
  +
  +Object paramValue = null;
  +try {
  +paramValue = TagUtils.getInstance().lookup(pageContext, paramName

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java

2003-07-25 Thread dgraham
dgraham 2003/07/25 18:22:31

  Modified:src/share/org/apache/struts/taglib/html
JavascriptValidatorTag.java FormTag.java
   src/share/org/apache/struts/taglib/bean StrutsTag.java
   src/share/org/apache/struts/taglib/logic ForwardTag.java
   src/share/org/apache/struts/util RequestUtils.java
   src/share/org/apache/struts/taglib TagUtils.java
  Log:
  Moved getModuleConfig() to TagUtils.
  
  Revision  ChangesPath
  1.34  +5 -5  
jakarta-struts/src/share/org/apache/struts/taglib/html/JavascriptValidatorTag.java
  
  Index: JavascriptValidatorTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/JavascriptValidatorTag.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- JavascriptValidatorTag.java   26 Jul 2003 01:17:55 -  1.33
  +++ JavascriptValidatorTag.java   26 Jul 2003 01:22:30 -  1.34
  @@ -361,7 +361,7 @@
   protected String renderJavascript() {
   StringBuffer results = new StringBuffer();
   
  -ModuleConfig config = RequestUtils.getModuleConfig(pageContext);
  +ModuleConfig config = TagUtils.getInstance().getModuleConfig(pageContext);
   ValidatorResources resources =
   (ValidatorResources) pageContext.getAttribute(
   ValidatorPlugIn.VALIDATOR_KEY + config.getPrefix(),
  
  
  
  1.51  +6 -5  
jakarta-struts/src/share/org/apache/struts/taglib/html/FormTag.java
  
  Index: FormTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/FormTag.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- FormTag.java  8 Jul 2003 00:05:10 -   1.50
  +++ FormTag.java  26 Jul 2003 01:22:30 -  1.51
  @@ -77,6 +77,7 @@
   import org.apache.struts.action.ActionServlet;
   import org.apache.struts.config.FormBeanConfig;
   import org.apache.struts.config.ModuleConfig;
  +import org.apache.struts.taglib.TagUtils;
   import org.apache.struts.util.MessageResources;
   import org.apache.struts.util.RequestUtils;
   import org.apache.struts.util.ResponseUtils;
  @@ -799,7 +800,7 @@
   protected void lookup() throws JspException {
   
   // Look up the module configuration information we need
  -moduleConfig = RequestUtils.getModuleConfig(pageContext);
  +moduleConfig = TagUtils.getInstance().getModuleConfig(pageContext);
   
   if (moduleConfig == null) {
   JspException e = new 
JspException(messages.getMessage("formTag.collections"));
  
  
  
  1.14  +7 -5  
jakarta-struts/src/share/org/apache/struts/taglib/bean/StrutsTag.java
  
  Index: StrutsTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/StrutsTag.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- StrutsTag.java9 Nov 2002 16:30:02 -   1.13
  +++ StrutsTag.java26 Jul 2003 01:22:31 -  1.14
  @@ -65,7 +65,9 @@
   
   import javax.servlet.jsp.JspException;
   import javax.servlet.jsp.tagext.TagSupport;
  +
   import org.apache.struts.config.ModuleConfig;
  +import org.apache.struts.taglib.TagUtils;
   import org.apache.struts.util.MessageResources;
   import org.apache.struts.util.RequestUtils;
   
  @@ -176,7 +178,7 @@
   }
   
   // Retrieve our application module configuration information
  -ModuleConfig config = RequestUtils.getModuleConfig(pageContext);
  +ModuleConfig config = TagUtils.getInstance().getModuleConfig(pageContext);
   
   // Retrieve the requested object to be exposed
   Object object = null;
  
  
  
  1.17  +6 -5  
jakarta-struts/src/share/org/apache/struts/taglib/logic/ForwardTag.java
  
  Index: ForwardTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/ForwardTag.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ForwardTag.java   13 Jul 2003 23:37:30 -  1.16
  +++ ForwardTag.java   26 Jul 2003 01:22:31 -  1.17
  @@ -68,6 +68,7 @@
   
   import org.apache.struts.action.ActionForward;
   import org.apache.struts.config.ModuleConfig;
  +import org.apache.struts.taglib.TagUtils;
   import org.apache.struts.util.MessageResources;
   import org.apache.struts.util.RequestUtils;
   
  @@ -126,7 +127,7 @@
   
   // Look up the desired ActionForward entry
   ActionForward forward = null;
  -ModuleConfig config = RequestUtils.getModuleConfig(pageContext);
  +ModuleConfig config = TagUtils.get

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java

2003-07-25 Thread dgraham
dgraham 2003/07/25 18:17:56

  Modified:src/share/org/apache/struts/taglib/html
JavascriptValidatorTag.java HtmlTag.java
   src/share/org/apache/struts/util RequestUtils.java
   src/share/org/apache/struts/taglib/bean WriteTag.java
   src/share/org/apache/struts/taglib TagUtils.java
  Log:
  Moved RequestUtils.retrieveUserLocale() to TagUtils.getUserLocale().
  
  Revision  ChangesPath
  1.33  +6 -5  
jakarta-struts/src/share/org/apache/struts/taglib/html/JavascriptValidatorTag.java
  
  Index: JavascriptValidatorTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/JavascriptValidatorTag.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- JavascriptValidatorTag.java   25 Jul 2003 23:46:27 -  1.32
  +++ JavascriptValidatorTag.java   26 Jul 2003 01:17:55 -  1.33
  @@ -82,6 +82,7 @@
   import org.apache.commons.validator.Var;
   import org.apache.struts.Globals;
   import org.apache.struts.config.ModuleConfig;
  +import org.apache.struts.taglib.TagUtils;
   import org.apache.struts.util.MessageResources;
   import org.apache.struts.util.RequestUtils;
   import org.apache.struts.validator.Resources;
  @@ -366,7 +367,7 @@
   ValidatorPlugIn.VALIDATOR_KEY + config.getPrefix(),
   PageContext.APPLICATION_SCOPE);
   
  -Locale locale = RequestUtils.retrieveUserLocale(this.pageContext, null);
  +Locale locale = TagUtils.getInstance().getUserLocale(this.pageContext, 
null);
   
   Form form = resources.get(locale, formName);
   if (form != null) {
  
  
  
  1.16  +7 -7  
jakarta-struts/src/share/org/apache/struts/taglib/html/HtmlTag.java
  
  Index: HtmlTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/HtmlTag.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- HtmlTag.java  12 Jul 2003 00:35:08 -  1.15
  +++ HtmlTag.java  26 Jul 2003 01:17:55 -  1.16
  @@ -70,8 +70,8 @@
   import javax.servlet.jsp.tagext.TagSupport;
   
   import org.apache.struts.Globals;
  +import org.apache.struts.taglib.TagUtils;
   import org.apache.struts.util.MessageResources;
  -import org.apache.struts.util.RequestUtils;
   import org.apache.struts.util.ResponseUtils;
   
   /**
  @@ -177,7 +177,7 @@
   language = this.getCurrentLocale().getLanguage();
   } else {
   Locale currentLocale =
  -RequestUtils.retrieveUserLocale(pageContext, Globals.LOCALE_KEY);
  +TagUtils.getInstance().getUserLocale(pageContext, 
Globals.LOCALE_KEY);
   
   language = currentLocale.getLanguage();
   country = currentLocale.getCountry();
  @@ -258,7 +258,7 @@
*/
   protected Locale getCurrentLocale() {
   
  -Locale userLocale = RequestUtils.retrieveUserLocale(pageContext, 
Globals.LOCALE_KEY);
  +Locale userLocale = TagUtils.getInstance().getUserLocale(pageContext, 
Globals.LOCALE_KEY);
   
   // Store a new current Locale, if requested
   if (this.locale) {
  
  
  
  1.117 +7 -5  
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.116
  retrieving revision 1.117
  diff -u -r1.116 -r1.117
  --- RequestUtils.java 26 Jul 2003 01:11:43 -  1.116
  +++ RequestUtils.java 26 Jul 2003 01:17:55 -  1.117
  @@ -949,9 +949,11 @@
* @param locale Name of the session attribute for our user's Locale.  If this 
is 
* null, the default locale key is used for the lookup.
* @return current user locale
  + * @deprecated Use TagUtils.getUserLocale() instead.  This will be removed 
  + * after Struts 1.2.
*/
   public static Locale retrieveUserLocale(PageContext pageContext, String locale) 
{
  -return getUserLocale((HttpServletRequest) pageContext.getRequest(), locale);
  +return TagUtils.getInstance().getUserLocale(pageContext, locale);
   }
   
   /**
  
  
  
  1.24  +6 -5  
jakarta-struts/src/share/org/apache/struts/taglib/bean/WriteTag.java
  
  Index: WriteTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/WriteTag.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- WriteTag.java 16 Jul 2003 05:13:10 -  1.23
  +++ WriteTag.java 26 Jul 2003 01:17:55 -  1.2

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java

2003-07-25 Thread dgraham
dgraham 2003/07/25 18:02:30

  Modified:src/share/org/apache/struts/taglib TagUtils.java
  Log:
  Added @since tag.
  
  Revision  ChangesPath
  1.2   +1 -0  jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java
  
  Index: TagUtils.java
  ===
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TagUtils.java 26 Jul 2003 01:00:01 -  1.1
  +++ TagUtils.java 26 Jul 2003 01:02:30 -  1.2
  @@ -78,6 +78,7 @@
* @author James Turner
* @author David Graham
* @version $Revision$
  + * @since Struts 1.2
*/
   public class TagUtils {
   
  
  
  

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



cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java

2003-07-25 Thread dgraham
dgraham 2003/07/25 18:00:01

  Modified:src/share/org/apache/struts/taglib/html ErrorsTag.java
   src/share/org/apache/struts/taglib/logic
MessagesPresentTag.java
  Added:   src/share/org/apache/struts/taglib TagUtils.java
  Log:
  Added TagUtils class for taglibs to use instead of RequestUtils.  We should 
  migrate any method in RequestUtils that takes a PageContext parameter
  and/or throws JspException.  A clean separation will help keep RequestUtils
  smaller and allow the taglibs to be easily split off of the core Struts distro.
  
  Revision  ChangesPath
  1.23  +6 -5  
jakarta-struts/src/share/org/apache/struts/taglib/html/ErrorsTag.java
  
  Index: ErrorsTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ErrorsTag.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- ErrorsTag.java2 Jul 2003 02:24:12 -   1.22
  +++ ErrorsTag.java26 Jul 2003 01:00:01 -  1.23
  @@ -70,6 +70,7 @@
   import org.apache.struts.Globals;
   import org.apache.struts.action.ActionError;
   import org.apache.struts.action.ActionErrors;
  +import org.apache.struts.taglib.TagUtils;
   import org.apache.struts.util.MessageResources;
   import org.apache.struts.util.RequestUtils;
   import org.apache.struts.util.ResponseUtils;
  @@ -184,7 +185,7 @@
   // Were any error messages specified?
   ActionErrors errors = null;
   try {
  -errors = RequestUtils.getActionErrors(pageContext, name);
  +errors = TagUtils.getInstance().getActionErrors(pageContext, name);
   } catch (JspException e) {
   RequestUtils.saveException(pageContext, e);
   throw e;
  
  
  
  1.8   +3 -2  
jakarta-struts/src/share/org/apache/struts/taglib/logic/MessagesPresentTag.java
  
  Index: MessagesPresentTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/MessagesPresentTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MessagesPresentTag.java   13 Jul 2003 23:20:16 -  1.7
  +++ MessagesPresentTag.java   26 Jul 2003 01:00:01 -  1.8
  @@ -61,6 +61,7 @@
   
   import org.apache.struts.Globals;
   import org.apache.struts.action.ActionMessages;
  +import org.apache.struts.taglib.TagUtils;
   import org.apache.struts.util.RequestUtils;
   
   /**
  @@ -129,7 +130,7 @@
   try {
   // Definitely know it should be an error so use method to retrieve 
errors.
   if (Globals.ERROR_KEY.equals(name)) {
  -am = RequestUtils.getActionErrors(pageContext, name);
  +am = TagUtils.getInstance().getActionErrors(pageContext, name);
   } else {
   am = RequestUtils.getActionMessages(pageContext, name);
   }
  
  
  
  1.1  jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java
  
  Index: TagUtils.java
  ===
  /*
   * $Header$
   * $Revision$
   * $Date$
   *
   * 
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-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 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 EX