From ccc163d1ad4a44c43501f45024f7ae5e896231e2 Mon Sep 17 00:00:00 2001 From: xinyuan-zhang Date: Thu, 15 Jun 2017 11:29:00 +0800 Subject: [PATCH 1/2] [port 2.2.8] https://github.com/javaserverfaces/mojarra/issues/4221 RenderKitUtils.renderJsfJsIfNecessary() does not invoke a Renderer to render jsf.js modified: jsf-ri/src/main/java/com/sun/faces/renderkit/RenderKitUtils.java --- .../com/sun/faces/renderkit/RenderKitUtils.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/jsf-ri/src/main/java/com/sun/faces/renderkit/RenderKitUtils.java b/jsf-ri/src/main/java/com/sun/faces/renderkit/RenderKitUtils.java index 50a9b7e652..1f6fcc3e8f 100644 --- a/jsf-ri/src/main/java/com/sun/faces/renderkit/RenderKitUtils.java +++ b/jsf-ri/src/main/java/com/sun/faces/renderkit/RenderKitUtils.java @@ -1082,16 +1082,11 @@ public static void renderJsfJs(FacesContext context) throws IOException { } // Since we've now determined that it's not in the page, we need to add it. - ResourceHandler handler = context.getApplication().getResourceHandler(); - Resource resource = handler.createResource(name, library); - ResponseWriter writer = context.getResponseWriter(); - writer.write('\n'); - writer.startElement("script", null); - writer.writeAttribute("type", "text/javascript", null); - writer.writeAttribute("src", ((resource != null) ? resource.getRequestPath() : ""), null); - writer.endElement("script"); - writer.append('\r'); - writer.append('\n'); + UIOutput output = new UIOutput(); + output.setRendererType("javax.faces.resource.Script"); + output.getAttributes().put("name", name); + output.getAttributes().put("library", library); + output.encodeAll(context); // Set the context to record script as included setScriptAsRendered(context); From 1cef79ff3042871cbe5012a85f0602dd6d2319c7 Mon Sep 17 00:00:00 2001 From: vsingleton Date: Tue, 10 Jan 2017 10:13:55 -0500 Subject: [PATCH 2/2] [2.2 back port] https://java.net/jira/browse/JAVASERVERFACES-4209 The renderer for h:outputLink should not prepend the namespace prefix to parameter names --- .../html_basic/OutputLinkRenderer.java | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/jsf-ri/src/main/java/com/sun/faces/renderkit/html_basic/OutputLinkRenderer.java b/jsf-ri/src/main/java/com/sun/faces/renderkit/html_basic/OutputLinkRenderer.java index 744794d5a4..3b2f4c00d6 100644 --- a/jsf-ri/src/main/java/com/sun/faces/renderkit/html_basic/OutputLinkRenderer.java +++ b/jsf-ri/src/main/java/com/sun/faces/renderkit/html_basic/OutputLinkRenderer.java @@ -47,12 +47,9 @@ import javax.faces.component.UIComponent; import javax.faces.component.UIOutput; -import javax.faces.component.UIViewRoot; import javax.faces.context.FacesContext; import javax.faces.context.ResponseWriter; -import com.sun.faces.config.WebConfiguration; -import com.sun.faces.config.WebConfiguration.BooleanWebContextInitParameter; import com.sun.faces.renderkit.Attribute; import com.sun.faces.renderkit.AttributeManager; import com.sun.faces.renderkit.RenderKitUtils; @@ -74,16 +71,9 @@ public class OutputLinkRenderer extends LinkRenderer { private static final Attribute[] ATTRIBUTES = AttributeManager.getAttributes(AttributeManager.Key.OUTPUTLINK); - protected boolean namespaceParameters; - // ---------------------------------------------------------- Public Methods - public OutputLinkRenderer() { - WebConfiguration webConfig = WebConfiguration.getInstance(); - namespaceParameters = webConfig.isOptionEnabled(BooleanWebContextInitParameter.NamespaceParameters); - } - @Override public void decode(FacesContext context, UIComponent component) { @@ -230,17 +220,9 @@ protected void renderAsActive(FacesContext context, UIComponent component) StringBuffer sb = new StringBuffer(); sb.append(hrefVal); boolean paramWritten = (hrefVal.indexOf('?') > 0); - String namingContainerId = null; - if (namespaceParameters) { - UIViewRoot viewRoot = context.getViewRoot(); - namingContainerId = viewRoot.getContainerClientId(context); - } for (int i = 0, len = paramList.length; i < len; i++) { String pn = paramList[i].name; if (pn != null && pn.length() != 0) { - if (namingContainerId != null) { - pn = namingContainerId + pn; - } String pv = paramList[i].value; sb.append((paramWritten) ? '&' : '?'); sb.append(URLEncoder.encode(pn,"UTF-8"));