You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sc...@apache.org on 2005/04/06 20:23:36 UTC

cvs commit: incubator-myfaces/src/myfaces/org/apache/myfaces/portlet MyFacesGenericPortlet.java PortletUtil.java

schof       2005/04/06 11:23:36

  Modified:    src/myfaces/org/apache/myfaces/portlet
                        MyFacesGenericPortlet.java PortletUtil.java
  Log:
  Fixes MYFACES-101.  Used a patch from Stan while @infra sorts out his karma.
  
  Revision  Changes    Path
  1.3       +5 -6      incubator-myfaces/src/myfaces/org/apache/myfaces/portlet/MyFacesGenericPortlet.java
  
  Index: MyFacesGenericPortlet.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/myfaces/org/apache/myfaces/portlet/MyFacesGenericPortlet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MyFacesGenericPortlet.java	10 Feb 2005 20:24:17 -0000	1.2
  +++ MyFacesGenericPortlet.java	6 Apr 2005 18:23:36 -0000	1.3
  @@ -54,6 +54,9 @@
    * @author  Stan Silvert (latest modification by $Author$)
    * @version $Revision$ $Date$
    * $Log$
  + * Revision 1.3  2005/04/06 18:23:36  schof
  + * Fixes MYFACES-101.  Used a patch from Stan while @infra sorts out his karma.
  + *
    * Revision 1.2  2005/02/10 20:24:17  matzew
    * closed MYFACES-101 in Jira; Thanks to Stan Silvert (JBoss Group)
    *
  @@ -69,10 +72,6 @@
       public static final String VIEW_ID =
           MyFacesGenericPortlet.class.getName() + ".VIEW_ID";
       
  -    // Signifies to MyFaces that the request is coming from a portlet.
  -    public static final String PORTLET_REQUEST_FLAG = 
  -        MyFacesGenericPortlet.class.getName() + ".PORTLET_REQUEST_FLAG";
  -    
       // PortletSession attribute
       private static final String CURRENT_FACES_CONTEXT = 
           MyFacesGenericPortlet.class.getName() + ".CURRENT_FACES_CONTEXT";
  @@ -330,7 +329,7 @@
       
       private void setPortletRequestFlag(PortletRequest request)
       {
  -        request.getPortletSession().setAttribute(PORTLET_REQUEST_FLAG, "true");
  +        request.getPortletSession().setAttribute(PortletUtil.PORTLET_REQUEST_FLAG, "true");
       }
       
       /**
  
  
  
  1.3       +18 -28    incubator-myfaces/src/myfaces/org/apache/myfaces/portlet/PortletUtil.java
  
  Index: PortletUtil.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/myfaces/org/apache/myfaces/portlet/PortletUtil.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PortletUtil.java	11 Feb 2005 03:55:49 -0000	1.2
  +++ PortletUtil.java	6 Apr 2005 18:23:36 -0000	1.3
  @@ -1,12 +1,12 @@
   /*
    * Copyright 2005 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -24,35 +24,25 @@
    *
    * @author  Stan Silvert
    */
  -public final class PortletUtil 
  -{
  +public class PortletUtil {
       
  -    /** Don't allow a new instance of PortletUtil */
  -    private PortletUtil() 
  -    {
  -    }
  +        // Signifies to MyFaces that the request is coming from a portlet.
  +        public static final String PORTLET_REQUEST_FLAG = 
  +           PortletUtil.class.getName() + ".PORTLET_REQUEST_FLAG";
       
  -    public static boolean isRenderResponse(FacesContext facesContext)
  -    {
  -        if (!isPortletRequest(facesContext)) return false;
  +        /** Don't allow a new instance of PortletUtil */
  +        private PortletUtil() {
  +        }
           
  -        try{
  +        public static boolean isRenderResponse(FacesContext facesContext) {
  +            if (!isPortletRequest(facesContext)) return false;
  +            
               return facesContext.getExternalContext().getResponse() instanceof RenderResponse;
  -        }catch(NoClassDefFoundError e){
  -            // noop
           }
  -        return false;
  -    }
  -    
  -    public static boolean isPortletRequest(FacesContext facesContext)
  -    {
  -        try{
  +        
  +        public static boolean isPortletRequest(FacesContext facesContext) {
               return facesContext.getExternalContext()
  -                           .getSessionMap()
  -                           .get(MyFacesGenericPortlet.PORTLET_REQUEST_FLAG) != null;
  -        }catch(NoClassDefFoundError e){
  -            // noop
  +            .getSessionMap()
  +            .get(PORTLET_REQUEST_FLAG) != null;
           }
  -        return false;
  -    }
  -}
  \ No newline at end of file
  +    }
  \ No newline at end of file