rleland     2003/07/26 10:21:03

  Modified:    src/share/org/apache/struts/util RequestUtils.java
  Log:
  Move lookup() methods and save exceptions() to Taglib
  so TagUtil.getScope() only used by taglibs.
  *************
  Overall we may need a glue class, instead of calling this a
  tagutil since other display technologies other than JSP might be able to make
  use of this library.
  *************
  
  Revision  Changes    Path
  1.120     +16 -59    
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.119
  retrieving revision 1.120
  diff -u -r1.119 -r1.120
  --- RequestUtils.java 26 Jul 2003 01:23:32 -0000      1.119
  +++ RequestUtils.java 26 Jul 2003 17:21:02 -0000      1.120
  @@ -266,7 +266,7 @@
           Map map = null;
           try {
               if (name != null) {
  -                map = (Map) lookup(pageContext, name, property, scope);
  +                map = (Map) TagUtils.getInstance().lookup(pageContext, name, 
property, scope);
               }
           } catch (ClassCastException e) {
               saveException(pageContext, e);
  @@ -289,7 +289,7 @@
   
               Object paramValue = null;
               try {
  -                paramValue = lookup(pageContext, paramName, paramProperty, 
paramScope);
  +                paramValue = TagUtils.getInstance().lookup(pageContext, paramName, 
paramProperty, paramScope);
               } catch (JspException e) {
                   saveException(pageContext, e);
                   throw e;
  @@ -842,22 +842,12 @@
        * @return JavaBean in the specified page context
        * @exception JspException if an invalid scope name
        *  is requested
  +     * @deprecated To be removed after Struts 1.2.
  +     * Use [EMAIL PROTECTED] 
org.apache.struts.taglib.TagUtils#lookup(PageContext,String,String)} instead.
        */
       public static Object lookup(PageContext pageContext, String name, String 
scopeName)
           throws JspException {
  -            
  -        if (scopeName == null) {
  -            return pageContext.findAttribute(name);
  -        }
  -        
  -        try {
  -            return pageContext.getAttribute(name, getScope(scopeName));
  -        
  -        } catch (JspException e) {
  -            saveException(pageContext, e);
  -            throw e;
  -        }
  -
  +        return TagUtils.getInstance().lookup(pageContext,name,scopeName);
       }
       
       /**
  @@ -867,8 +857,9 @@
        * @return The constant representing the scope (ie. PageContext.REQUEST_SCOPE).
        * @throws JspException if the scopeName is not a valid name.
        * @since Struts 1.1
  -     * @deprecated Use TagUtils.getScope() instead.  This will be removed after 
  -     * Struts 1.2.
  +     * @deprecated To be removed after Struts 1.2.
  +     * Use [EMAIL PROTECTED] org.apache.struts.taglib.TagUtils#getScope(String)} 
instead.
  +
        */
       public static int getScope(String scopeName) throws JspException {
           return TagUtils.getInstance().getScope(scopeName);
  @@ -894,6 +885,9 @@
        * @exception JspException if accessing this property causes an
        *  IllegalAccessException, IllegalArgumentException,
        *  InvocationTargetException, or NoSuchMethodException
  +     * @deprecated To be removed after Struts 1.2.
  +     * Use [EMAIL PROTECTED] 
org.apache.struts.taglib.TagUtils#lookup(PageContext,String,String,String)} instead.
  +
        */
       public static Object lookup(
           PageContext pageContext,
  @@ -902,44 +896,7 @@
           String scope)
           throws JspException {
   
  -        // Look up the requested bean, and return if requested
  -        Object bean = lookup(pageContext, name, scope);
  -        if (bean == null) {
  -            JspException e = null;
  -            if (scope == null) {
  -                e = new JspException(messages.getMessage("lookup.bean.any", name));
  -            } else {
  -                e = new JspException(messages.getMessage("lookup.bean", name, 
scope));
  -            }
  -            saveException(pageContext, e);
  -            throw e;
  -        }
  -        
  -        if (property == null) {
  -            return bean;
  -        }
  -
  -        // 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));
  -        }
  -
  +        return TagUtils.getInstance().lookup(pageContext,name,property,scope);
       }
   
       /**
  
  
  

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

Reply via email to