You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by dg...@apache.org on 2003/04/17 05:51:12 UTC

cvs commit: jakarta-struts/src/share/org/apache/struts/tiles TilesUtilImpl.java ComponentDefinition.java TilesUtilStrutsImpl.java TilesUtil.java TilesPlugin.java TilesServlet.java

dgraham     2003/04/16 20:51:12

  Modified:    src/share/org/apache/struts/tiles TilesUtilImpl.java
                        ComponentDefinition.java TilesUtilStrutsImpl.java
                        TilesUtil.java TilesPlugin.java TilesServlet.java
  Log:
  Deprecated TilesUtil.applicationClass() in favor of RequestUtils.applicationClass()
  for PR# 19070.
  
  Revision  Changes    Path
  1.4       +7 -5      jakarta-struts/src/share/org/apache/struts/tiles/TilesUtilImpl.java
  
  Index: TilesUtilImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/tiles/TilesUtilImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TilesUtilImpl.java	22 Mar 2003 00:25:30 -0000	1.3
  +++ TilesUtilImpl.java	17 Apr 2003 03:51:12 -0000	1.4
  @@ -7,7 +7,7 @@
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2002 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
  @@ -74,6 +74,7 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.struts.tiles.definition.ComponentDefinitionsFactoryWrapper;
  +import org.apache.struts.util.RequestUtils;
   
     /**
      * Default implementation of TilesUtil.
  @@ -232,10 +233,11 @@
        * @param className Fully qualified class name to be loaded.
        * @return Class object.
        * @exception ClassNotFoundException if the class cannot be found
  +     * @deprecated Use RequestUtils.applicationClass() instead.
        */
     public Class applicationClass(String className) throws ClassNotFoundException
     {
  -  return Class.forName(className);
  +    return RequestUtils.applicationClass(className);
     }
   
   }
  
  
  
  1.7       +8 -6      jakarta-struts/src/share/org/apache/struts/tiles/ComponentDefinition.java
  
  Index: ComponentDefinition.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/tiles/ComponentDefinition.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ComponentDefinition.java	25 Jan 2003 05:52:35 -0000	1.6
  +++ ComponentDefinition.java	17 Apr 2003 03:51:12 -0000	1.7
  @@ -7,7 +7,7 @@
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2002 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
  @@ -63,10 +63,12 @@
   package org.apache.struts.tiles;
   
   import java.io.Serializable;
  -import java.util.Map;
   import java.util.HashMap;
  +import java.util.Map;
  +
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  +import org.apache.struts.util.RequestUtils;
   
   /**
    * Definition of a template / component attributes.
  @@ -560,7 +562,7 @@
      {
       try
        {
  -     Class requestedClass = TilesUtil.applicationClass(classname);
  +     Class requestedClass = RequestUtils.applicationClass(classname);
        Object instance = requestedClass.newInstance();
        /*
        if( instance instanceof org.apache.struts.action.Action )
  
  
  
  1.4       +8 -8      jakarta-struts/src/share/org/apache/struts/tiles/TilesUtilStrutsImpl.java
  
  Index: TilesUtilStrutsImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/tiles/TilesUtilStrutsImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TilesUtilStrutsImpl.java	27 Feb 2003 19:20:50 -0000	1.3
  +++ TilesUtilStrutsImpl.java	17 Apr 2003 03:51:12 -0000	1.4
  @@ -7,7 +7,7 @@
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2002 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
  @@ -82,11 +82,11 @@
        * @param className Fully qualified class name to be loaded.
        * @return Class object.
        * @exception ClassNotFoundException if the class cannot be found
  +     * @deprecated Use RequestUtils.applicationClass() instead.
        */
  -  public Class applicationClass(String className) throws ClassNotFoundException
  -  {
  -  return RequestUtils.applicationClass(className);
  -  }
  +    public Class applicationClass(String className) throws ClassNotFoundException {
  +        return RequestUtils.applicationClass(className);
  +    }
   
       /**
        * Get definition factory for the module attached to the specified moduleConfig.
  
  
  
  1.7       +13 -13    jakarta-struts/src/share/org/apache/struts/tiles/TilesUtil.java
  
  Index: TilesUtil.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/tiles/TilesUtil.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TilesUtil.java	22 Mar 2003 00:25:30 -0000	1.6
  +++ TilesUtil.java	17 Apr 2003 03:51:12 -0000	1.7
  @@ -7,7 +7,7 @@
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2002 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
  @@ -172,11 +172,10 @@
        * @param response Current page response.
        * @param servletContext Current servlet context.
        */
  -  public static void doInclude(String uri, PageContext pageContext)
  -        throws IOException, ServletException
  -  {
  -  tilesUtilImpl.doInclude(uri, pageContext);
  -  }
  +    public static void doInclude(String uri, PageContext pageContext)
  +        throws IOException, ServletException {
  +        TilesUtilImpl.doInclude(uri, pageContext);
  +    }
   
       /**
        * Get definition factory from appropriate servlet context.
  @@ -239,11 +238,12 @@
        * @param className Fully qualified class name to be loaded.
        * @return Class object.
        * @exception ClassNotFoundException if the class cannot be found
  +     * @deprecated Use RequestUtils.applicationClass() instead.
        */
  -  public static Class applicationClass(String className) throws ClassNotFoundException
  -  {
  -  return tilesUtilImpl.applicationClass(className);
  -  }
  +    public static Class applicationClass(String className)
  +        throws ClassNotFoundException {
  +        return tilesUtilImpl.applicationClass(className);
  +    }
   
   
       /**
  
  
  
  1.20      +9 -6      jakarta-struts/src/share/org/apache/struts/tiles/TilesPlugin.java
  
  Index: TilesPlugin.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/tiles/TilesPlugin.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- TilesPlugin.java	27 Feb 2003 19:20:50 -0000	1.19
  +++ TilesPlugin.java	17 Apr 2003 03:51:12 -0000	1.20
  @@ -7,7 +7,7 @@
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2002 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
  @@ -188,8 +188,11 @@
           { // A classname is specified for the tilesUtilImp, use it.
           try
             {
  -          TilesUtilStrutsImpl impl = (TilesUtilStrutsImpl)TilesUtil.applicationClass( getTilesUtilImplClassname() ).newInstance();
  -          TilesUtil.setTilesUtil(impl);
  +        TilesUtilStrutsImpl impl =
  +            (TilesUtilStrutsImpl) RequestUtils
  +                .applicationClass(getTilesUtilImplClassname())
  +                .newInstance();
  +        TilesUtil.setTilesUtil(impl);
             }
            catch( ClassCastException ex )
             {
  
  
  
  1.5       +5 -5      jakarta-struts/src/share/org/apache/struts/tiles/TilesServlet.java
  
  Index: TilesServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/tiles/TilesServlet.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TilesServlet.java	25 Jan 2003 05:52:35 -0000	1.4
  +++ TilesServlet.java	17 Apr 2003 03:51:12 -0000	1.5
  @@ -7,7 +7,7 @@
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2002 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
  @@ -75,8 +75,8 @@
    * parameters available with the specified factory.
    * This servlet is intended to be used in application using Tiles without Struts.
    * @author Cedric Dumoulin
  + * @deprecated Use the ActionServlet instead.
    */
  -
   public class TilesServlet extends HttpServlet
   {
       /** Commons Logging instance. */
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Re: cvs commit: jakarta-struts/src/share/org/apache/struts/tiles TilesUtilImpl.java ComponentDefinition.java TilesUtilStrutsImpl.java TilesUtil.java TilesPlugin.java TilesServlet.java

Posted by Cedric Dumoulin <ce...@apache.org>.
  Hi,

  Changing the calls to TilesUtil.applicationClass() in favor of 
RequestUtils.applicationClass() introduce a dependencies on 
RequestUtils, which I would like to avoid and limit to few (struts 
related) classes.
  Limiting this dependency allow to use the tiles package without 
struts. Don't ask me why, but there is some users that want to use only 
tiles, without struts.
  It is why I have created a TilesUtil class with different 
implementations depending on what the users want:

    * TilesUtilImpl: default impl, used without struts
    * TilesUtilStrutsImpl: impl for struts (1.0.x and 1.1 without modules)
    * TilesUtilStrutsModulesImpl: impl for struts1.1 with modules

  So, to be able to use Tiles without Struts and fix the bug 19070, we 
should:

    * TilesUtil.applicationClass() should not be deprecated now (maybe
      in a later major release). (revert to previous version)
    * TilesUtilImpl.java should not depend on RequestUtils, so it should
      not be modified. (revert to previous version)
    * TilePlugin should use RequestUtils.applicationClass() (keep the
      modification) <-- this should fixe the bug
    * TilesServlet is used to initialize the tiles factory without
      Struts. It should not be deprecated (revert to previous version)
    * ComponentDefinition should not depend on RequestUtils (revert to
      previous version)
    * TilesUtilStrutsImpl (revert to previous version)

  Cedric


>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org