[jboss-cvs] jboss-portal/portlet/src/main/org/jboss/portal/portlet/impl/spi ...

Julien Viet julien at jboss.com
Sun Jul 30 12:17:10 EDT 2006


  User: julien  
  Date: 06/07/30 12:17:10

  Modified:    portlet/src/main/org/jboss/portal/portlet/impl/spi 
                        AbstractInvocationContext.java
  Log:
  scope the cached markup fragments to the identity of the user
  
  Revision  Changes    Path
  1.5       +22 -1     jboss-portal/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractInvocationContext.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: AbstractInvocationContext.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-portal/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractInvocationContext.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- AbstractInvocationContext.java	18 Jun 2006 03:25:10 -0000	1.4
  +++ AbstractInvocationContext.java	30 Jul 2006 16:17:10 -0000	1.5
  @@ -31,7 +31,7 @@
    * An abstract implementation.
    *
    * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public abstract class AbstractInvocationContext implements InvocationContext
   {
  @@ -76,6 +76,20 @@
               session.setAttribute(name, value);
            }
         }
  +      else if (PRINCIPAL_SCOPE == scope)
  +      {
  +         HttpSession session = getClientRequest().getSession();
  +         String userName = getClientRequest().getRemoteUser();
  +         String key = userName == null ? "principal.." + name : "principal." + userName + "." + name;
  +         if (value == null)
  +         {
  +            session.removeAttribute(key);
  +         }
  +         else
  +         {
  +            session.setAttribute(key, value);
  +         }
  +      }
         else
         {
            throw new IllegalArgumentException("This scope cannot be accepted " + scope);
  @@ -93,6 +107,13 @@
            HttpSession session = getClientRequest().getSession();
            return session.getAttribute(name);
         }
  +      if (PRINCIPAL_SCOPE == scope)
  +      {
  +         String userName = getClientRequest().getRemoteUser();
  +         String key = userName == null ? "principal.." + name : "principal." + userName + "." + name;
  +         HttpSession session = getClientRequest().getSession();
  +         return session.getAttribute(key);
  +      }
         else
         {
            throw new IllegalArgumentException("This scope cannot be accepted " + scope);
  
  
  



More information about the jboss-cvs-commits mailing list