portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From morci...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/util PortletSessionState.java
Date Thu, 03 Oct 2002 21:46:48 GMT
morciuch    2002/10/03 14:46:48

  Modified:    src/java/org/apache/jetspeed/util PortletSessionState.java
  Log:
  Method isMyRequest will always return TRUE if "js_peid" was not part of the request (for
backwards compatibility).
  
  Revision  Changes    Path
  1.5       +31 -5     jakarta-jetspeed/src/java/org/apache/jetspeed/util/PortletSessionState.java
  
  Index: PortletSessionState.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/util/PortletSessionState.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PortletSessionState.java	20 Sep 2002 21:19:37 -0000	1.4
  +++ PortletSessionState.java	3 Oct 2002 21:46:48 -0000	1.5
  @@ -177,21 +177,47 @@
       }
   
       /**
  -     * Returns true if the request pertains to current portlet instance
  +     * Returns true if the request pertains to current portlet instance. It assumes that
the portlet interested in
  +     * recognizing its own requests, has a hidden input "js_peid". For backwards compatibility,
if "js_peid" was
  +     * not set, this method will return TRUE.
        * 
        * @param rundata
        * @return boolean
        */
       public static boolean isMyRequest(RunData rundata, Portlet portlet) {
   
  +        // If the request does not contain "js_peid", assume that the portlet is not interested

  +        // in isMyRequest functionality and return TRUE.
  +        String requestPeid = rundata.getParameters().getString("js_peid");
  +        if (requestPeid == null || requestPeid.equalsIgnoreCase(""))
  +        {
  +            return true;
  +        }
  +
  +        // If the portlet does not have its id set, assume that the portlet is not interested
  +        // in isMyRequest functionality and return TRUE.
  +        if (portlet == null || portlet.getID() == null)
  +        {
  +            return true;
  +        }
  +
  +        // Retrieve portlet instance
  +        String peId = null;
           PortletInstance instance = PersistenceManager.getInstance(portlet, rundata);
  -        String peId = instance.getPortlet().getID();
  +        if (instance != null)
  +        {
  +            peId = instance.getPortlet().getID();
  +        }
   
  -        //Log.debug("PortletSessionState.isMyRequest: portlet="+ portlet.getName() + ",
peid=" + peId + ", js_peid=" + rundata.getParameters().getString("js_peid"));
  -        if(peId != null && peId.equals(rundata.getParameters().getString("js_peid")))
  +        // Compare the ids
  +        if (peId != null && peId.equals(requestPeid))
  +        {
               return true;
  +        }
           else
  +        {
               return false;
  +        }
       }
   
       /**
  
  
  

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


Mime
View raw message