dgraham     2003/09/13 11:40:34

  Modified:    src/share/org/apache/struts/taglib/tiles InsertTag.java
               src/share/org/apache/struts/tiles ActionController.java
                        Controller.java ControllerSupport.java
                        TilesRequestProcessor.java UrlController.java
               src/tiles-documentation/org/apache/struts/webapp/tiles/portal
                        UserMenuAction.java
  Log:
  Added execute() method to Controller interface for
  PR# 19022.
  
  Revision  Changes    Path
  1.23      +6 -5      
jakarta-struts/src/share/org/apache/struts/taglib/tiles/InsertTag.java
  
  Index: InsertTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/tiles/InsertTag.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- InsertTag.java    13 Sep 2003 00:33:27 -0000      1.22
  +++ InsertTag.java    13 Sep 2003 18:40:34 -0000      1.23
  @@ -913,11 +913,12 @@
                                // Call controller if any
                                if (controller != null) {
                                        try {
  -                                             controller.perform(
  +                                             controller.execute(
                                                        subCompContext,
                                                        (HttpServletRequest) 
pageContext.getRequest(),
                                                        (HttpServletResponse) 
pageContext.getResponse(),
                                                        
pageContext.getServletContext());
  +                            
                                        } catch (Exception e) {
                                                throw new ServletException(e);
                                        }
  
  
  
  1.7       +19 -5     
jakarta-struts/src/share/org/apache/struts/tiles/ActionController.java
  
  Index: ActionController.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/tiles/ActionController.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ActionController.java     13 Sep 2003 00:30:50 -0000      1.6
  +++ ActionController.java     13 Sep 2003 18:40:34 -0000      1.7
  @@ -92,8 +92,8 @@
   
        /**
         * Method associated to a tile and called immediately before tile is 
  -     * included.  This implementation calls a Struts Action. No servlet is 
  -     * set by this method.
  +      * included.  This implementation calls a Struts Action. No servlet is 
  +      * set by this method.
         *
         * @param tileContext Current tile context.
         * @param request Current request.
  @@ -113,5 +113,19 @@
                } catch (Exception e) {
                        throw new ServletException(e);
                }
  +     }
  +
  +     /**
  +      * @see 
org.apache.struts.tiles.Controller#execute(org.apache.struts.tiles.ComponentContext, 
javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, 
javax.servlet.ServletContext)
  +      */
  +     public void execute(
  +             ComponentContext tileContext,
  +             HttpServletRequest request,
  +             HttpServletResponse response,
  +             ServletContext servletContext)
  +             throws Exception {
  +            
  +             this.action.execute(null, null, request, response);
  +
        }
   }
  
  
  
  1.4       +20 -3     jakarta-struts/src/share/org/apache/struts/tiles/Controller.java
  
  Index: Controller.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/tiles/Controller.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Controller.java   13 Sep 2003 00:30:50 -0000      1.3
  +++ Controller.java   13 Sep 2003 18:40:34 -0000      1.4
  @@ -83,6 +83,8 @@
         * @param request Current request
         * @param response Current response
         * @param servletContext Current servlet context
  +     * @deprecated Use execute() instead.  This will be removed after 
  +     * Struts 1.2.
         */
        public void perform(
                ComponentContext tileContext,
  @@ -90,4 +92,19 @@
                HttpServletResponse response,
                ServletContext servletContext)
                throws ServletException, IOException;
  +        
  +    /**
  +     * Method associated to a tile and called immediately before the tile 
  +     * is included.
  +     * @param tileContext Current tile context.
  +     * @param request Current request
  +     * @param response Current response
  +     * @param servletContext Current servlet context
  +     */
  +    public void execute(
  +        ComponentContext tileContext,
  +        HttpServletRequest request,
  +        HttpServletResponse response,
  +        ServletContext servletContext)
  +        throws Exception;
   }
  
  
  
  1.4       +20 -3     
jakarta-struts/src/share/org/apache/struts/tiles/ControllerSupport.java
  
  Index: ControllerSupport.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/tiles/ControllerSupport.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ControllerSupport.java    13 Sep 2003 00:30:50 -0000      1.3
  +++ ControllerSupport.java    13 Sep 2003 18:40:34 -0000      1.4
  @@ -90,5 +90,22 @@
                ServletContext servletContext)
                throws ServletException, IOException {
   
  +             try {
  +                     this.execute(tileContext, request, response, servletContext);
  +             } catch (Exception e) {
  +                     throw new ServletException(e);
  +             }
  +     }
  +
  +     /**
  +      * @see 
org.apache.struts.tiles.Controller#execute(org.apache.struts.tiles.ComponentContext, 
javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, 
javax.servlet.ServletContext)
  +      */
  +     public void execute(
  +             ComponentContext tileContext,
  +             HttpServletRequest request,
  +             HttpServletResponse response,
  +             ServletContext servletContext)
  +             throws Exception {
  +
        }
   }
  
  
  
  1.22      +5 -4      
jakarta-struts/src/share/org/apache/struts/tiles/TilesRequestProcessor.java
  
  Index: TilesRequestProcessor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/tiles/TilesRequestProcessor.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- TilesRequestProcessor.java        13 Sep 2003 00:33:27 -0000      1.21
  +++ TilesRequestProcessor.java        13 Sep 2003 18:40:34 -0000      1.22
  @@ -256,11 +256,12 @@
                // Execute controller associated to definition, if any.
                if (controller != null) {
                        try {
  -                             controller.perform(
  +                             controller.execute(
                                        tileContext,
                                        request,
                                        response,
                                        getServletContext());
  +                    
                        } catch (Exception e) {
                                throw new ServletException(e); 
                        }
  
  
  
  1.5       +23 -3     
jakarta-struts/src/share/org/apache/struts/tiles/UrlController.java
  
  Index: UrlController.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/tiles/UrlController.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- UrlController.java        13 Sep 2003 00:30:50 -0000      1.4
  +++ UrlController.java        13 Sep 2003 18:40:34 -0000      1.5
  @@ -114,4 +114,24 @@
                rd.include(request, response);
        }
   
  +     /**
  +      * @see 
org.apache.struts.tiles.Controller#execute(org.apache.struts.tiles.ComponentContext, 
javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, 
javax.servlet.ServletContext)
  +      */
  +     public void execute(
  +             ComponentContext tileContext,
  +             HttpServletRequest request,
  +             HttpServletResponse response,
  +             ServletContext servletContext)
  +             throws Exception {
  +            
  +             RequestDispatcher rd = servletContext.getRequestDispatcher(url);
  +             if (rd == null) {
  +                     throw new ServletException(
  +                             "Controller can't find url '" + url + "'.");
  +             }
  +
  +             rd.include(request, response);
  +
  +     }
  +
   }
  
  
  
  1.6       +29 -6     
jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/portal/UserMenuAction.java
  
  Index: UserMenuAction.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/portal/UserMenuAction.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- UserMenuAction.java       13 Sep 2003 00:30:50 -0000      1.5
  +++ UserMenuAction.java       13 Sep 2003 18:40:34 -0000      1.6
  @@ -179,12 +179,12 @@
                HttpServletResponse response)
                throws Exception {
   
  -             this.perform(
  +             this.execute(
                        context,
                        request,
                        response,
                        getServlet().getServletContext());
  -            
  +
                return null;
        }
   
  @@ -368,6 +368,29 @@
                } else if (object instanceof MenuItem) {
                        result.add(object);
                }
  +     }
  +
  +     /**
  +      * @see 
org.apache.struts.tiles.Controller#execute(org.apache.struts.tiles.ComponentContext, 
javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, 
javax.servlet.ServletContext)
  +      */
  +     public void execute(
  +             ComponentContext tileContext,
  +             HttpServletRequest request,
  +             HttpServletResponse response,
  +             ServletContext servletContext)
  +             throws Exception {
  +            
  +             log.debug("Enter action UserMenuAction");
  +
  +             // Load user settings from user context
  +             MenuSettings settings = getUserSettings(request, tileContext);
  +
  +             // Set parameters for rendering page
  +             tileContext.putAttribute(USER_ITEMS_ATTRIBUTE, settings.getItems());
  +
  +             log.debug("settings=" + settings);
  +             log.debug("Exit action UserMenuAction");
  +
        }
   
   }
  
  
  

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

Reply via email to