You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by me...@apache.org on 2022/04/30 11:59:10 UTC
[myfaces] branch 2.3-next updated: JSF provides a encodeBegin() and an encodeEnd() method on a Renderer. MyFaces currently performs "begin tag" and "end tag" encoding in the encodeEnd(), which breaks any vendor-neutral path for extensibility. This patch moves the "begin tag" encoding logic to the encodeBegin() function so the renderkit can be extended without needing to extend myfaces classes explicitly, but instead be called through the standard JSF api to start a tag. (#260)
This is an automated email from the ASF dual-hosted git repository.
melloware pushed a commit to branch 2.3-next
in repository https://gitbox.apache.org/repos/asf/myfaces.git
The following commit(s) were added to refs/heads/2.3-next by this push:
new 3f342cf93 JSF provides a encodeBegin() and an encodeEnd() method on a Renderer. MyFaces currently performs "begin tag" and "end tag" encoding in the encodeEnd(), which breaks any vendor-neutral path for extensibility. This patch moves the "begin tag" encoding logic to the encodeBegin() function so the renderkit can be extended without needing to extend myfaces classes explicitly, but instead be called through the standard JSF api to start a tag. (#260)
3f342cf93 is described below
commit 3f342cf933fc1905e06bc674a5a9f1b5b2a6c3e1
Author: glynn leininger <gl...@hotmail.com>
AuthorDate: Sat Apr 30 06:59:06 2022 -0500
JSF provides a encodeBegin() and an encodeEnd() method on a Renderer. MyFaces currently performs "begin tag" and "end tag" encoding in the encodeEnd(), which breaks any vendor-neutral path for extensibility. This patch moves the "begin tag" encoding logic to the encodeBegin() function so the renderkit can be extended without needing to extend myfaces classes explicitly, but instead be called through the standard JSF api to start a tag. (#260)
Co-authored-by: glynn.leininger <gl...@emoneyusa.com>
---
.../html/base/HtmlTextareaRendererBase.java | 20 ++++++++++----------
.../renderkit/html/HtmlTextareaRendererTest.java | 2 ++
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlTextareaRendererBase.java b/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlTextareaRendererBase.java
index 87f1c9c06..966b81a0a 100644
--- a/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlTextareaRendererBase.java
+++ b/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlTextareaRendererBase.java
@@ -44,33 +44,33 @@ import org.apache.myfaces.renderkit.html.util.JSFAttr;
public class HtmlTextareaRendererBase extends HtmlRenderer
{
private static final String ADD_NEW_LINE_AT_START_ATTR = "org.apache.myfaces.addNewLineAtStart";
-
+
@Override
- public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException
+ public void encodeBegin(FacesContext facesContext, UIComponent uiComponent)
+ throws IOException
{
RendererUtils.checkParamValidity(facesContext, uiComponent, UIInput.class);
+ Map<String, List<ClientBehavior>> behaviors = null;
if (uiComponent instanceof ClientBehaviorHolder)
{
- Map<String, List<ClientBehavior>> behaviors = ((ClientBehaviorHolder) uiComponent).getClientBehaviors();
+ behaviors = ((ClientBehaviorHolder) uiComponent).getClientBehaviors();
if (!behaviors.isEmpty())
{
- ResourceUtils.renderDefaultJsfJsInlineIfNecessary(facesContext,
+ ResourceUtils.renderDefaultJsfJsInlineIfNecessary(facesContext,
facesContext.getResponseWriter());
}
}
-
- encodeTextArea(facesContext, uiComponent);
+ renderTextAreaBegin(facesContext, uiComponent);
}
- protected void encodeTextArea(FacesContext facesContext, UIComponent uiComponent) throws IOException
+ @Override
+ public void encodeEnd(FacesContext facesContext, UIComponent uiComponent)
+ throws IOException
{
- //allow subclasses to render custom attributes by separating rendering begin and end
- renderTextAreaBegin(facesContext, uiComponent);
renderTextAreaValue(facesContext, uiComponent);
renderTextAreaEnd(facesContext, uiComponent);
-
}
//Subclasses can set the value of an attribute before, or can render a custom attribute after calling this method
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTextareaRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTextareaRendererTest.java
index 2f4392119..1eb2ed722 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTextareaRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTextareaRendererTest.java
@@ -68,6 +68,7 @@ public class HtmlTextareaRendererTest extends AbstractJsfTestCase
public void testRenderDefault() throws Exception
{
+ inputTextarea.encodeBegin(facesContext);
inputTextarea.encodeEnd(facesContext);
facesContext.renderResponse();
@@ -79,6 +80,7 @@ public class HtmlTextareaRendererTest extends AbstractJsfTestCase
{
inputTextarea.setCols(5);
inputTextarea.setRows(10);
+ inputTextarea.encodeBegin(facesContext);
inputTextarea.encodeEnd(facesContext);
facesContext.renderResponse();