You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2014/09/15 21:05:20 UTC
svn commit: r1625111 - in /myfaces/shared/trunk/core: ./
src/main/java/org/apache/myfaces/shared/config/
src/main/java/org/apache/myfaces/shared/context/
src/main/java/org/apache/myfaces/shared/context/flash/
src/main/java/org/apache/myfaces/shared/ren...
Author: lu4242
Date: Mon Sep 15 19:05:20 2014
New Revision: 1625111
URL: http://svn.apache.org/r1625111
Log:
update shared for 2.2.5 release
Modified:
myfaces/shared/trunk/core/pom.xml
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/SwitchAjaxExceptionHandlerWrapperImpl.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlGroupRendererBase.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
myfaces/shared/trunk/core/src/main/resources/META-INF/myfaces-metadata.xml
Modified: myfaces/shared/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/pom.xml?rev=1625111&r1=1625110&r2=1625111&view=diff
==============================================================================
--- myfaces/shared/trunk/core/pom.xml (original)
+++ myfaces/shared/trunk/core/pom.xml Mon Sep 15 19:05:20 2014
@@ -143,7 +143,7 @@
<profile>
<id>synch-myfaces-impl-shared</id>
<properties>
- <myfaces.impl.shared.version>2.2.4-SNAPSHOT</myfaces.impl.shared.version>
+ <myfaces.impl.shared.version>2.2.5-SNAPSHOT</myfaces.impl.shared.version>
</properties>
<activation>
<property>
Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java?rev=1625111&r1=1625110&r2=1625111&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java Mon Sep 15 19:05:20 2014
@@ -466,6 +466,15 @@ public class MyfacesConfig
public static final String INIT_PARAM_RENDER_FORM_VIEW_STATE_AT_BEGIN =
"org.apache.myfaces.RENDER_FORM_VIEW_STATE_AT_BEGIN";
public final static boolean INIT_PARAM_RENDER_FORM_VIEW_STATE_AT_BEGIN_DEFAULT = false;
+
+ /**
+ * Defines whether flash scope is disabled, preventing add the Flash cookie to the response.
+ *
+ * <p>This is useful for applications that does not require to use flash scope, and instead uses other scopes.</p>
+ */
+ @JSFWebConfigParam(defaultValue="false",since="2.0.5")
+ public static final String INIT_PARAM_FLASH_SCOPE_DISABLED = "org.apache.myfaces.FLASH_SCOPE_DISABLED";
+ public static final boolean INIT_PARAM_FLASH_SCOPE_DISABLED_DEFAULT = false;
private boolean _prettyHtml;
private boolean _detectJavascript;
@@ -504,6 +513,7 @@ public class MyfacesConfig
private boolean _cdiManagedValidatorsEnabled;
private boolean _strictJsf2FaceletsCompatibility;
private boolean _renderFormViewStateAtBegin;
+ private boolean _flashScopeDisabled;
private static final boolean TOMAHAWK_AVAILABLE;
private static final boolean MYFACES_IMPL_AVAILABLE;
@@ -610,6 +620,7 @@ public class MyfacesConfig
setCdiManagedValidatorsEnabled(INIT_PARAM_CDI_MANAGED_VALIDATORS_DEFAULT);
setStrictJsf2FaceletsCompatibility(INIT_PARAM_STRICT_JSF_2_FACELETS_COMPATIBILITY_DEFAULT);
setRenderFormViewStateAtBegin(INIT_PARAM_RENDER_FORM_VIEW_STATE_AT_BEGIN_DEFAULT);
+ setFlashScopeDisabled(INIT_PARAM_FLASH_SCOPE_DISABLED_DEFAULT);
}
private static MyfacesConfig createAndInitializeMyFacesConfig(ExternalContext extCtx)
@@ -736,6 +747,10 @@ public class MyfacesConfig
INIT_PARAM_RENDER_FORM_VIEW_STATE_AT_BEGIN,
INIT_PARAM_RENDER_FORM_VIEW_STATE_AT_BEGIN_DEFAULT));
+ myfacesConfig.setFlashScopeDisabled(WebConfigParamUtils.getBooleanInitParameter(extCtx,
+ INIT_PARAM_FLASH_SCOPE_DISABLED,
+ INIT_PARAM_FLASH_SCOPE_DISABLED_DEFAULT));
+
if (TOMAHAWK_AVAILABLE)
{
myfacesConfig.setDetectJavascript(getBooleanInitParameter(extCtx, INIT_PARAM_DETECT_JAVASCRIPT,
@@ -1313,4 +1328,14 @@ public class MyfacesConfig
{
this._renderFormViewStateAtBegin = renderFormViewStateAtBegin;
}
+
+ public boolean isFlashScopeDisabled()
+ {
+ return _flashScopeDisabled;
+ }
+
+ public void setFlashScopeDisabled(boolean flashScopeDisabled)
+ {
+ this._flashScopeDisabled = flashScopeDisabled;
+ }
}
Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/SwitchAjaxExceptionHandlerWrapperImpl.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/SwitchAjaxExceptionHandlerWrapperImpl.java?rev=1625111&r1=1625110&r2=1625111&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/SwitchAjaxExceptionHandlerWrapperImpl.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/SwitchAjaxExceptionHandlerWrapperImpl.java Mon Sep 15 19:05:20 2014
@@ -21,6 +21,7 @@ package org.apache.myfaces.shared.contex
import javax.faces.context.ExceptionHandler;
import javax.faces.context.ExceptionHandlerWrapper;
import javax.faces.context.FacesContext;
+import javax.faces.context.PartialViewContext;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ExceptionQueuedEvent;
import javax.faces.event.ExceptionQueuedEventContext;
@@ -82,7 +83,12 @@ public class SwitchAjaxExceptionHandlerW
if (_isAjaxRequest == null)
{
facesContext = (facesContext == null) ? FacesContext.getCurrentInstance() : facesContext;
- _isAjaxRequest = facesContext.getPartialViewContext().isAjaxRequest();
+ PartialViewContext pvc = facesContext.getPartialViewContext();
+ if (pvc == null)
+ {
+ return false;
+ }
+ _isAjaxRequest = pvc.isAjaxRequest();
}
return _isAjaxRequest;
}
@@ -92,7 +98,12 @@ public class SwitchAjaxExceptionHandlerW
if (_isAjaxRequest == null)
{
FacesContext facesContext = FacesContext.getCurrentInstance();
- _isAjaxRequest = facesContext.getPartialViewContext().isAjaxRequest();
+ PartialViewContext pvc = facesContext.getPartialViewContext();
+ if (pvc == null)
+ {
+ return false;
+ }
+ _isAjaxRequest = pvc.isAjaxRequest();
}
return _isAjaxRequest;
}
Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java?rev=1625111&r1=1625110&r2=1625111&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java Mon Sep 15 19:05:20 2014
@@ -19,7 +19,6 @@
package org.apache.myfaces.shared.context.flash;
import org.apache.myfaces.shared.util.SubKeyMap;
-import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam;
import org.apache.myfaces.shared.util.ExternalContextUtils;
import javax.faces.application.FacesMessage;
@@ -46,6 +45,7 @@ import javax.faces.event.PostPutFlashVal
import javax.faces.event.PreClearFlashEvent;
import javax.faces.event.PreRemoveFlashValueEvent;
import javax.faces.lifecycle.ClientWindow;
+import org.apache.myfaces.shared.config.MyfacesConfig;
/**
* Implementation of Flash object
@@ -58,14 +58,6 @@ public class FlashImpl extends Flash
private static final Logger log = Logger.getLogger(FlashImpl.class.getName());
/**
- * Defines whether flash scope is disabled, preventing add the Flash cookie to the response.
- *
- * <p>This is useful for applications that does not require to use flash scope, and instead uses other scopes.</p>
- */
- @JSFWebConfigParam(defaultValue="false",since="2.0.5")
- private static final String FLASH_SCOPE_DISABLED_PARAM = "org.apache.myfaces.FLASH_SCOPE_DISABLED";
-
- /**
* Use this prefix instead of the whole class name, because
* this makes the Cookies and the SubKeyMap operations (actually
* every String based operation where this is used as a key) faster.
@@ -203,7 +195,7 @@ public class FlashImpl extends Flash
_count = new AtomicLong(_getSeed());
// Read whether flash scope is disabled.
- _flashScopeDisabled = "true".equalsIgnoreCase(externalContext.getInitParameter(FLASH_SCOPE_DISABLED_PARAM));
+ _flashScopeDisabled = MyfacesConfig.getCurrentInstance(externalContext).isFlashScopeDisabled();
}
// ~ methods from javax.faces.context.Flash -------------------------------
@@ -1115,7 +1107,7 @@ public class FlashImpl extends Flash
if (_flashScopeDisabled)
{
throw new FlashScopeDisabledException("Flash scope was disabled by context param "
- + FLASH_SCOPE_DISABLED_PARAM + " but erroneously accessed");
+ + MyfacesConfig.INIT_PARAM_FLASH_SCOPE_DISABLED + " but erroneously accessed");
}
}
Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlGroupRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlGroupRendererBase.java?rev=1625111&r1=1625110&r2=1625111&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlGroupRendererBase.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlGroupRendererBase.java Mon Sep 15 19:05:20 2014
@@ -26,6 +26,10 @@ import javax.faces.component.html.HtmlPa
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import javax.faces.component.behavior.ClientBehavior;
+import org.apache.myfaces.shared.renderkit.html.util.ResourceUtils;
public class HtmlGroupRendererBase
extends HtmlRenderer
@@ -64,23 +68,51 @@ public class HtmlGroupRendererBase
{
layoutElement = HTML.DIV_ELEM;
}
+
+ Map<String, List<ClientBehavior>> behaviors = panelGroup.getClientBehaviors();
+ if (behaviors != null && !behaviors.isEmpty())
+ {
+ ResourceUtils.renderDefaultJsfJsInlineIfNecessary(context, writer);
+ }
- if(component.getId()!=null && !component.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX))
+ if( (!behaviors.isEmpty()) ||
+ (component.getId()!=null && !component.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX)))
{
span = true;
writer.startElement(layoutElement, component);
- HtmlRendererUtils.writeIdIfNecessary(writer, component, context);
+ //HtmlRendererUtils.writeIdIfNecessary(writer, component, context);
+ writer.writeAttribute(HTML.ID_ATTR, component.getClientId(context), null);
+ long commonPropertiesMarked = 0L;
if (isCommonPropertiesOptimizationEnabled(context))
{
- CommonPropertyUtils.renderCommonPassthroughProperties(writer,
+ commonPropertiesMarked = CommonPropertyUtils.getCommonPropertiesMarked(component);
+ CommonPropertyUtils.renderCommonPassthroughPropertiesWithoutEvents(writer,
CommonPropertyUtils.getCommonPropertiesMarked(component), component);
}
else
{
- HtmlRendererUtils.renderHTMLAttributes(writer, component, HTML.COMMON_PASSTROUGH_ATTRIBUTES);
+ HtmlRendererUtils.renderHTMLAttributes(writer, component, HTML.UNIVERSAL_ATTRIBUTES);
+ }
+ if (behaviors.isEmpty() && isCommonPropertiesOptimizationEnabled(context))
+ {
+ CommonPropertyUtils.renderEventProperties(writer,
+ commonPropertiesMarked, component);
+ }
+ else
+ {
+ if (isCommonEventsOptimizationEnabled(context))
+ {
+ CommonEventUtils.renderBehaviorizedEventHandlers(context, writer,
+ commonPropertiesMarked,
+ CommonEventUtils.getCommonEventsMarked(component), component, behaviors);
+ }
+ else
+ {
+ HtmlRendererUtils.renderBehaviorizedEventHandlers(context, writer, component, behaviors);
+ }
}
}
else
Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java?rev=1625111&r1=1625110&r2=1625111&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java Mon Sep 15 19:05:20 2014
@@ -129,8 +129,9 @@ public final class HtmlJavaScriptUtils
private static void prepareScript(FacesContext facesContext,
ScriptContext context, boolean autoScroll)
{
-
- final char separatorChar = facesContext.getNamingContainerSeparatorChar();
+ // MYFACES-3919 remember idcl separator char is special and always should be ':',
+ // because it should be hardcoded into the js file.
+ final char idclSeparatorChar = ':';
context.prettyLine();
//render a function to create a hidden input, if it doesn't exist
@@ -274,7 +275,7 @@ public final class HtmlJavaScriptUtils
context.prettyLine();
context.append(SET_HIDDEN_INPUT_FN_NAME);
- context.append("(formName,formName +'" + separatorChar + "'+'"
+ context.append("(formName,formName +'" + idclSeparatorChar + "'+'"
+ HtmlRendererUtils.HIDDEN_COMMANDLINK_FIELD_NAME
+ "',linkId);");
@@ -327,7 +328,7 @@ public final class HtmlJavaScriptUtils
context.prettyLine();
context.append(CLEAR_HIDDEN_INPUT_FN_NAME);
- context.append("(formName,formName +'" + separatorChar + "'+'"
+ context.append("(formName,formName +'" + idclSeparatorChar + "'+'"
+ HtmlRendererUtils.HIDDEN_COMMANDLINK_FIELD_NAME
+ "',linkId);");
Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java?rev=1625111&r1=1625110&r2=1625111&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java Mon Sep 15 19:05:20 2014
@@ -1547,8 +1547,8 @@ public final class HtmlRendererUtils
{
return HIDDEN_COMMANDLINK_FIELD_NAME_TRINIDAD;
}
- return formInfo.getFormName() + FacesContext.getCurrentInstance().getNamingContainerSeparatorChar()
- + HIDDEN_COMMANDLINK_FIELD_NAME;
+ return formInfo.getFormName() + ':'
+ + HIDDEN_COMMANDLINK_FIELD_NAME;
}
public static String getHiddenCommandLinkFieldName(
@@ -1558,7 +1558,7 @@ public final class HtmlRendererUtils
{
return HIDDEN_COMMANDLINK_FIELD_NAME_TRINIDAD;
}
- return formInfo.getFormName() + FacesContext.getCurrentInstance().getNamingContainerSeparatorChar()
+ return formInfo.getFormName() + ':'
+ HIDDEN_COMMANDLINK_FIELD_NAME;
}
@@ -1592,7 +1592,7 @@ public final class HtmlRendererUtils
public static String getHiddenCommandLinkFieldNameMyfacesOld(
FormInfo formInfo)
{
- return formInfo.getFormName() + FacesContext.getCurrentInstance().getNamingContainerSeparatorChar()
+ return formInfo.getFormName() + ':'
+ HIDDEN_COMMANDLINK_FIELD_NAME_MYFACES_OLD;
}
@@ -2785,4 +2785,4 @@ public final class HtmlRendererUtils
super(buf, prettyPrint);
}
}
-}
\ No newline at end of file
+}
Modified: myfaces/shared/trunk/core/src/main/resources/META-INF/myfaces-metadata.xml
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/resources/META-INF/myfaces-metadata.xml?rev=1625111&r1=1625110&r2=1625111&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/resources/META-INF/myfaces-metadata.xml (original)
+++ myfaces/shared/trunk/core/src/main/resources/META-INF/myfaces-metadata.xml Mon Sep 15 19:05:20 2014
@@ -9021,7 +9021,7 @@ but it does not include legacy 1.1 myfac
</webConfigParam>
<webConfigParam>
<name>org.apache.myfaces.FLASH_SCOPE_DISABLED</name>
- <fieldName>FLASH_SCOPE_DISABLED_PARAM</fieldName>
+ <fieldName>INIT_PARAM_FLASH_SCOPE_DISABLED</fieldName>
<desc>Defines whether flash scope is disabled, preventing add the Flash cookie to the response</desc>
<longDesc>
<![CDATA[
@@ -9031,7 +9031,7 @@ Defines whether flash scope is disabled,
]]>
</longDesc>
<defaultValue>false</defaultValue>
- <sourceClassName>org.apache.myfaces.shared.context.flash.FlashImpl</sourceClassName>
+ <sourceClassName>org.apache.myfaces.shared.config.MyfacesConfig</sourceClassName>
<since>2.0.5</since>
</webConfigParam>
<webConfigParam>