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/07/24 10:18:58 UTC

svn commit: r1613033 - 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: Thu Jul 24 08:18:57 2014
New Revision: 1613033

URL: http://svn.apache.org/r1613033
Log:
Merged from trunk
TOBAGO-1414

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:r1613015,1613032

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=1613033&r1=1613032&r2=1613033&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 Thu Jul 24 08:18:57 2014
@@ -27,6 +27,7 @@ import org.slf4j.LoggerFactory;
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
+import javax.servlet.ServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.util.Collections;
@@ -48,6 +49,10 @@ public final class AjaxUtils {
     return AjaxInternalUtils.isAjaxRequest(facesContext);
   }
 
+  public static boolean isAjaxRequest(final ServletRequest request) {
+    return AjaxInternalUtils.isAjaxRequest((Map<String, String>) request.getParameterMap());
+  }
+
   public static void removeAjaxComponent(final FacesContext facesContext, final String clientId) {
     final Map<String, UIComponent> ajaxComponents = AjaxInternalUtils.getAjaxComponents(facesContext);
     if (ajaxComponents != null) {

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:r1613015

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=1613033&r1=1613032&r2=1613033&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 Thu Jul 24 08:18:57 2014
@@ -222,11 +222,13 @@ public final class AjaxInternalUtils {
   }
 
   public static boolean isAjaxRequest(final FacesContext facesContext) {
-    final Map parameterMap = facesContext.getExternalContext().getRequestParameterMap();
-    final String ajaxComponentIds = (String) parameterMap.get(AjaxInternalUtils.TOBAGO_PARTIAL_IDS);
-    return ajaxComponentIds != null;
+    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)) {
@@ -265,7 +267,7 @@ public final class AjaxInternalUtils {
     final Writer writer = response.getWriter();
     writer.flush(); // is needed in some cases, e. g. TOBAGO-1094
     writer.write("{\n  \"tobagoAjaxResponse\": true,\n");
-    writer.write("  \"responseCode\": 309,\n");
+    writer.write("  \"responseCode\": " + AjaxResponseRenderer.CODE_RELOAD_REQUIRED + ",\n");
     writer.write("  \"location\": \"");
     writer.write(pathPrefix + facesContext.getViewRoot().getViewId());
     writer.write("\"\n}\n");

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:r1613015