portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed-2/portals-bridges/frameworks/src/java/org/apache/portals/bridges/frameworks GenericFrameworkPortlet.java FrameworkConstants.java ForwardTag.java
Date Fri, 05 Nov 2004 22:34:24 GMT
taylor      2004/11/05 14:34:23

  Modified:    portals-bridges/frameworks/src/java/org/apache/portals/bridges/frameworks
                        GenericFrameworkPortlet.java
                        FrameworkConstants.java ForwardTag.java
  Log:
  optimization on request paramter pollution
  remove the request parameter if using the default view
  hoping that setting it to null removes it from the request parameter collection
  be best if there was an api for this
  
  Revision  Changes    Path
  1.5       +55 -9     jakarta-jetspeed-2/portals-bridges/frameworks/src/java/org/apache/portals/bridges/frameworks/GenericFrameworkPortlet.java
  
  Index: GenericFrameworkPortlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portals-bridges/frameworks/src/java/org/apache/portals/bridges/frameworks/GenericFrameworkPortlet.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- GenericFrameworkPortlet.java	5 Nov 2004 03:56:52 -0000	1.4
  +++ GenericFrameworkPortlet.java	5 Nov 2004 22:34:23 -0000	1.5
  @@ -314,30 +314,76 @@
           {
               if (request.getPortletMode().equals(PortletMode.VIEW))
               {
  -                response.setRenderParameter(FrameworkConstants.VIEW_VIEW_MODE, view);
  +                if (view == null || view.equals(this.getDefaultViewPage()))
  +                {
  +                    // clear it
  +                    response.setRenderParameter(FrameworkConstants.VIEW_VIEW_MODE, (String)null);
  +                }
  +                else
  +                {
  +                    response.setRenderParameter(FrameworkConstants.VIEW_VIEW_MODE, view);
  +                }
               }
  -            else if (request.getPortletMode().equals(PortletMode.EDIT))
  +            else if (view == null || request.getPortletMode().equals(PortletMode.EDIT))
               {
  -                response.setRenderParameter(FrameworkConstants.VIEW_EDIT_MODE, view);
  +                if (view == null || view.equals(this.getDefaultEditPage()))
  +                {
  +                    // clear it
  +                    response.setRenderParameter(FrameworkConstants.VIEW_EDIT_MODE, (String)null);
  +                }
  +                else
  +                {                
  +                    response.setRenderParameter(FrameworkConstants.VIEW_EDIT_MODE, view);
  +                }
               }
  -            else if (request.getPortletMode().equals(PortletMode.HELP))
  +            else if (view == null || request.getPortletMode().equals(PortletMode.HELP))
               {
  -                response.setRenderParameter(FrameworkConstants.VIEW_HELP_MODE, view);
  +                if (view == null || view.equals(this.getDefaultHelpPage()))
  +                {
  +                    response.setRenderParameter(FrameworkConstants.VIEW_HELP_MODE, (String)null);
                   
  +                }
  +                else
  +                {
  +                    response.setRenderParameter(FrameworkConstants.VIEW_HELP_MODE, view);
  +                }
               }
           }
           else
           {
               if (newMode.equals(PortletMode.VIEW))
               {
  -                response.setRenderParameter(FrameworkConstants.VIEW_VIEW_MODE, view);
  +                if (view == null || view.equals(this.getDefaultViewPage()))
  +                {
  +                    // clear it
  +                    response.setRenderParameter(FrameworkConstants.VIEW_VIEW_MODE, (String)null);
  +                }
  +                else
  +                {                                
  +                    response.setRenderParameter(FrameworkConstants.VIEW_VIEW_MODE, view);
  +                }
               }
               else if (newMode.equals(PortletMode.EDIT))
               {
  -                response.setRenderParameter(FrameworkConstants.VIEW_EDIT_MODE, view);
  +                if (view == null || view.equals(this.getDefaultEditPage()))
  +                {
  +                    // clear it
  +                    response.setRenderParameter(FrameworkConstants.VIEW_EDIT_MODE, (String)null);
  +                }
  +                else
  +                {                                
  +                    response.setRenderParameter(FrameworkConstants.VIEW_EDIT_MODE, view);
  +                }
               }
               else if (newMode.equals(PortletMode.HELP))
               {
  -                response.setRenderParameter(FrameworkConstants.VIEW_HELP_MODE, view);
  +                if (view == null || view.equals(this.getDefaultHelpPage()))
  +                {
  +                    response.setRenderParameter(FrameworkConstants.VIEW_HELP_MODE, (String)null);
                   
  +                }
  +                else
  +                {                
  +                    response.setRenderParameter(FrameworkConstants.VIEW_HELP_MODE, view);
  +                }
               }
           }
       }
  @@ -467,7 +513,7 @@
           }
   
           putRequestVariable(request, FrameworkConstants.FORWARD_TOOL, new Forwarder(model,
request, response));
  -        request.setAttribute("model", model);
  +        request.setAttribute(FrameworkConstants.MODEL_TOOL, model);
           
           PortletContext context = getPortletContext();
           PortletRequestDispatcher rd = context.getRequestDispatcher(template);
  
  
  
  1.2       +2 -1      jakarta-jetspeed-2/portals-bridges/frameworks/src/java/org/apache/portals/bridges/frameworks/FrameworkConstants.java
  
  Index: FrameworkConstants.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portals-bridges/frameworks/src/java/org/apache/portals/bridges/frameworks/FrameworkConstants.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FrameworkConstants.java	4 Nov 2004 22:17:30 -0000	1.1
  +++ FrameworkConstants.java	5 Nov 2004 22:34:23 -0000	1.2
  @@ -33,6 +33,7 @@
        * The name of the forward tool
        */
       final String FORWARD_TOOL = "forward";
  +    final String MODEL_TOOL = "bridges.model";
       
       /**
        * The name of the prefs variable
  
  
  
  1.2       +2 -2      jakarta-jetspeed-2/portals-bridges/frameworks/src/java/org/apache/portals/bridges/frameworks/ForwardTag.java
  
  Index: ForwardTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portals-bridges/frameworks/src/java/org/apache/portals/bridges/frameworks/ForwardTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ForwardTag.java	5 Nov 2004 03:56:52 -0000	1.1
  +++ ForwardTag.java	5 Nov 2004 22:34:23 -0000	1.2
  @@ -53,7 +53,7 @@
                   out.print("request response not found");
                   return SKIP_BODY;
               }
  -            PortletApplicationModel model = (PortletApplicationModel)request.getAttribute("model");
  +            PortletApplicationModel model = (PortletApplicationModel)request.getAttribute(FrameworkConstants.MODEL_TOOL);
               if (model == null)
               {
                   JspWriter out = pageContext.getOut();
  
  
  

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


Mime
View raw message