1 16 17 package org.apache.myfaces.portlet; 18 19 import javax.faces.context.FacesContext; 20 import javax.portlet.RenderResponse; 21 22 27 public class PortletUtil { 28 29 32 public static final String PORTLET_REQUEST_FLAG = 33 PortletUtil.class.getName() + ".PORTLET_REQUEST_FLAG"; 34 35 36 private PortletUtil() { 37 } 38 39 46 public static boolean isRenderResponse(FacesContext facesContext) { 47 if (!isPortletRequest(facesContext)) return false; 48 49 return facesContext.getExternalContext().getResponse() instanceof RenderResponse; 50 } 51 52 59 public static boolean isPortletRequest(FacesContext facesContext) { 60 return facesContext.getExternalContext() 61 .getSessionMap() 62 .get(PORTLET_REQUEST_FLAG) != null; 63 } 64 } | Popular Tags |