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 2016/10/06 13:42:20 UTC

svn commit: r1763590 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/ tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/

Author: lofwyr
Date: Thu Oct  6 13:42:20 2016
New Revision: 1763590

URL: http://svn.apache.org/viewvc?rev=1763590&view=rev
Log:
TOBAGO-1524: Use standard AJAX mechanism
* cleanup

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/FacesContextUtils.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/FacesContextUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/FacesContextUtils.java?rev=1763590&r1=1763589&r2=1763590&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/FacesContextUtils.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/FacesContextUtils.java Thu Oct  6 13:42:20 2016
@@ -31,7 +31,6 @@ import java.util.Set;
 @SuppressWarnings("unchecked")
 public final class FacesContextUtils {
 
-  private static final String TOBAGO_AJAX = "org.apache.myfaces.tobago.ajax";
   private static final String TOBAGO_ENCTYPE = "org.apache.myfaces.tobago.enctype";
   private static final String TOBAGO_SCRIPT_FILES = "org.apache.myfaces.tobago.scriptFiles";
   private static final String TOBAGO_STYLE_FILES = "org.apache.myfaces.tobago.styleFiles";
@@ -40,14 +39,6 @@ public final class FacesContextUtils {
   private FacesContextUtils() {
   }
 
-  public static boolean isAjax(final FacesContext context) {
-    return context.getAttributes().containsKey(TOBAGO_AJAX);
-  }
-
-  public static void setAjax(final FacesContext context, final boolean ajax) {
-    context.getAttributes().put(TOBAGO_AJAX, ajax);
-  }
-
   public static void setFocusId(final FacesContext context, final String focusId) {
     context.getAttributes().put(TOBAGO_FOCUS_ID, focusId);
   }

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java?rev=1763590&r1=1763589&r2=1763590&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java Thu Oct  6 13:42:20 2016
@@ -138,7 +138,7 @@ public class PageRenderer extends Render
     final boolean productionMode = tobagoConfig.getProjectStage() == ProjectStage.Production;
     final boolean preventFrameAttacks = tobagoConfig.isPreventFrameAttacks();
 
-    if (!FacesContextUtils.isAjax(facesContext)) {
+    if (!facesContext.getPartialViewContext().isAjaxRequest()) {
       final String title = page.getLabel();
 
       writer.startElement(HtmlElements.HEAD);
@@ -236,7 +236,7 @@ public class PageRenderer extends Render
     HtmlRendererUtils.renderCommandFacet(page, facesContext, writer);
 
     writer.startElement(HtmlElements.FORM);
-    if (preventFrameAttacks && !FacesContextUtils.isAjax(facesContext)) {
+    if (preventFrameAttacks && !facesContext.getPartialViewContext().isAjaxRequest()) {
       writer.writeClassAttribute(Classes.create(page, "preventFrameAttacks", Markup.NULL));
     }
     writer.writeAttribute(HtmlAttributes.ACTION, formAction, true);
@@ -364,7 +364,7 @@ public class PageRenderer extends Render
     writer.startElement(HtmlElements.SPAN);
     writer.writeIdAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "jsf-state-container");
     writer.flush();
-    if (!FacesContextUtils.isAjax(facesContext)) {
+    if (!facesContext.getPartialViewContext().isAjaxRequest()) {
       viewHandler.writeState(facesContext);
     }
     writer.endElement(HtmlElements.SPAN);