-
1. Re: Encoding, again
sergeysmirnov Apr 29, 2008 12:40 PM (in response to fabmars)any prove about your "*exactly*"? Code snippets, for example.
-
2. Re: Encoding, again
fabmars Apr 30, 2008 4:56 AM (in response to fabmars)Hello Sergey. Thanks for replying.
Actually I wanna make it clear I'm not sure whether RF is the cause of my issues, or if it's myself. Probably myself despite the *exactly* :) Until now RF has proven to be extremely useful and reliable with me.
Now the code of my renderer, interesting parts in bold. In a nutshell, this is a custom FCK Editor component, like the FCK doc says, you need to output 2 hidden components to configure the editor (begining of the code) and 1 iframe for the display of the editor (middle). Fallback case is a textarea (end of the code).public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException { super.encodeEnd(facesContext, uiComponent); ResponseWriter writer = facesContext.getResponseWriter(); HtmlFckEditor fckEditorComponent = (HtmlFckEditor) uiComponent; String clientId = fckEditorComponent.getClientId(facesContext); //the editor code writer.startElement("div", null); String value = (String)fckEditorComponent.getValue(); if(isCompatible(facesContext)) { //hidden input with original value writer.startElement("input", uiComponent); writer.writeAttribute("type", "hidden", null); writer.writeAttribute("id", clientId, null); writer.writeAttribute("name", clientId, null); writer.writeAttribute("value", value, null); writer.endElement("input"); //config String configId = clientId + "___Config"; writer.startElement("input", uiComponent); writer.writeAttribute("type", "hidden", null); writer.writeAttribute("id", configId, null); writer.writeAttribute("name", configId, null); writer.writeAttribute("value", getConfigUrl(fckEditorComponent), null); writer.endElement("input"); //frame url String basePath = fckEditorComponent.getBasePath(); if(basePath == null) { basePath = "/fckeditor/"; } else { if(!basePath.startsWith("/")) { basePath = "/" + basePath; } if(!basePath.endsWith("/")) { basePath += "/"; } } basePath = facesContext.getExternalContext().getRequestContextPath() + basePath; String frameLink = basePath + "editor/fckeditor.html?InstanceName=" + clientId; //toolbar String toolbarSet = fckEditorComponent.getToolbarSet(); if(toolbarSet != null && toolbarSet.length() > 0) { frameLink += "&Toolbar=" + toolbarSet; } //iframe String frameId = clientId + "___Frame"; writer.startElement("iframe", uiComponent); writer.writeAttribute("id", frameId, null); writer.writeURIAttribute("src", facesContext.getExternalContext() .encodeResourceURL(frameLink), null); String width = fckEditorComponent.getWidth(); if(width == null) { width = "100%"; } writer.writeAttribute("width", width, null); String height = fckEditorComponent.getHeight(); if(height == null) { height = "100%"; } writer.writeAttribute("height", height, null); writer.writeAttribute("frameborder", "no", null); writer.writeAttribute("scrolling", "no", null); writer.endElement("iframe"); writer.write("\n"); // Adding the onComplete callback writer.startElement("script", null); writer.writeAttribute("lang", "text/javascript", null); // Hidden iframe creation writer.writeText("function FCKeditor_OnComplete(editorInstance) { window.status = editorInstance.Description; }", null); writer.endElement("script"); } else { //regular textarea writer.startElement("textarea", uiComponent); writer.writeAttribute("id", clientId, null); writer.writeAttribute("rows", "4", null); writer.writeAttribute("cols", "40", null); String style = "width: " + fckEditorComponent.getWidth() + "; height: " + fckEditorComponent.getHeight(); writer.writeAttribute("style", style, null); writer.writeAttribute("wrap", "virtual", null); writer.writeText(value != null ? value : "", null); writer.endElement("textarea"); } writer.endElement("div"); writer.write("\n"); }
-
3. Re: Encoding, again
fabmars May 1, 2008 8:00 PM (in response to fabmars)Excuse me for insisting, but I realized actually all URI outputs are now escaped the same way as my component: all ampersands are escaped to %26 when using the NEKO filter, producing non-useable URLs.
Example:<h:outputLink value="http://www.google.com/search"> <f:param name="hl" value="en"/> <f:param name="q" value="RichFaces"/> <f:param name="btnG" value="Google+Search"/> <f:param name="meta" value=""/> <h:outputText value="Search RF on Google"/> </h:outputLink>
This code produces a wrong URL that Google will not be able to parse correctly when using the NEKO filter.
However, when using the TIDY filter, the output produces useable links.
Some side-effect happened between RF 3.1.x and 3.2.0 that made the NEKO filter totally useless in my opinion. Or is there a configuration thing I missed ?
Please answer :) -
4. Re: Encoding, again
alexsmirnov May 1, 2008 9:01 PM (in response to fabmars)Sorry, it was a real bug. I have fixed it in the current development code. see http://jira.jboss.com/jira/browse/RF-3320
-
-
6. Re: Encoding, again
zeppelinux May 19, 2008 2:30 AM (in response to fabmars)Hey fabmars,
Can you please share your JSF enabled FCK component?
I will appreciate very much! -
7. Re: Encoding, again
fabmars May 19, 2008 4:09 AM (in response to fabmars)write to <my username here> at gmail.com and I'll give you.
-
8. Re: Encoding, again
zeppelinux May 19, 2008 8:06 PM (in response to fabmars)i've got the component from fabmars.
It is nicely packaged, has ant build script and all config files, provided with 'readme' email and it works very well!
Thanks a Lot Man!