You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2014/08/01 16:42:56 UTC

svn commit: r1615124 - in /myfaces/tobago/branches/tobago-3.0.x: ./ tobago-core/src/main/java/org/apache/myfaces/tobago/ajax/AjaxUtils.java tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxInternalUtils.java

Author: lofwyr
Date: Fri Aug  1 14:42:56 2014
New Revision: 1615124

URL: http://svn.apache.org/r1615124
Log:
Merged from trunk
TOBAGO-1414: Utility method for AJAX Request detection in non-faces scenario
 - bugfix: The values of request.getParameterMap() are arrays of strings [from revision 1615114]
TOBAGO-1414: Utility method for AJAX Request detection in non-faces scenario
 - cleanup [from revision 1615121]

Modified:
    myfaces/tobago/branches/tobago-3.0.x/   (props changed)
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/ajax/AjaxUtils.java   (contents, props changed)
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxInternalUtils.java   (contents, props changed)

Propchange: myfaces/tobago/branches/tobago-3.0.x/
------------------------------------------------------------------------------
  Merged /myfaces/tobago/trunk:r1615114,1615121

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/ajax/AjaxUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/ajax/AjaxUtils.java?rev=1615124&r1=1615123&r2=1615124&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/ajax/AjaxUtils.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/ajax/AjaxUtils.java Fri Aug  1 14:42:56 2014
@@ -46,11 +46,13 @@ public final class AjaxUtils {
   }
 
   public static boolean isAjaxRequest(final FacesContext facesContext) {
-    return AjaxInternalUtils.isAjaxRequest(facesContext);
+    return facesContext.getExternalContext().getRequestParameterMap().get(AjaxInternalUtils.TOBAGO_PARTIAL_IDS) != null;
   }
 
   public static boolean isAjaxRequest(final ServletRequest request) {
-    return AjaxInternalUtils.isAjaxRequest((Map<String, String>) request.getParameterMap());
+    final String[] ajaxComponentIds
+        = ((Map<String, String[]>) request.getParameterMap()).get(AjaxInternalUtils.TOBAGO_PARTIAL_IDS);
+    return ajaxComponentIds != null && ajaxComponentIds.length > 0;
   }
 
   public static void removeAjaxComponent(final FacesContext facesContext, final String clientId) {

Propchange: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/ajax/AjaxUtils.java
------------------------------------------------------------------------------
  Merged /myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/ajax/AjaxUtils.java:r1615114,1615121

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxInternalUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxInternalUtils.java?rev=1615124&r1=1615123&r2=1615124&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxInternalUtils.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxInternalUtils.java Fri Aug  1 14:42:56 2014
@@ -221,17 +221,8 @@ public final class AjaxInternalUtils {
     }
   }
 
-  public static boolean isAjaxRequest(final FacesContext facesContext) {
-    return isAjaxRequest(facesContext.getExternalContext().getRequestParameterMap());
-  }
-
-  public static boolean isAjaxRequest(final Map<String, String> parameterMap) {
-    final String ajaxComponentIds = parameterMap.get(AjaxInternalUtils.TOBAGO_PARTIAL_IDS);
-    return ajaxComponentIds != null;
-  }
-
   public static boolean redirect(final FacesContext facesContext, final String url) throws IOException {
-    if (!isAjaxRequest(facesContext)) {
+    if (!AjaxUtils.isAjaxRequest(facesContext)) {
       return false;
     }
     redirect((HttpServletResponse) facesContext.getExternalContext().getResponse(), url);

Propchange: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxInternalUtils.java
------------------------------------------------------------------------------
  Merged /myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxInternalUtils.java:r1615114,1615121