myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sobr...@apache.org
Subject svn commit: r696090 - /myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java
Date Tue, 16 Sep 2008 22:41:33 GMT
Author: sobryan
Date: Tue Sep 16 15:41:32 2008
New Revision: 696090

URL: http://svn.apache.org/viewvc?rev=696090&view=rev
Log: (empty)

Modified:
    myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java

Modified: myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java?rev=696090&r1=696089&r2=696090&view=diff
==============================================================================
--- myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java
(original)
+++ myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java
Tue Sep 16 15:41:32 2008
@@ -321,6 +321,22 @@
 
     return _PORTLET_CONTEXT_CLASS.isInstance(externalContext.getContext());
   }
+  
+  /**
+   * Returns wherther of not this external context represents a true HttpServletRequest or
+   * not.  Some portal containers implement the PortletRequest/Response objects as 
+   * HttpServletRequestWrappers, and those objects should not be treated as an
+   * HttpServlerRequest.  As such, this method first tests to see if the request is
+   * a portlet request and, if not, then tests to see if the request is an instanceof
+   * HttpServletRequest.
+   * 
+   * @param request
+   * @return
+   */
+  public static boolean isHttpServletRequest(final ExternalContext externalContext)
+  {
+    return (!isPortlet(externalContext) && (externalContext.getRequest() instanceof
HttpServletRequest));
+  }
 
   private static final String _getPortletCharacterEncoding(final Object request)
   {



Mime
View raw message