com.liferay.faces.util.render
Class RendererUtil

java.lang.Object
  extended by com.liferay.faces.util.render.RendererUtil

public class RendererUtil
extends Object

Author:
Neil Griffin

Constructor Summary
RendererUtil()
           
 
Method Summary
static void addDefaultAjaxBehavior(javax.faces.component.behavior.ClientBehaviorHolder clientBehaviorHolder, String execute, String process, String defaultExecute, String render, String update, String defaultRender)
          Adds an Ajax behavior to the specified client behavior holder according to its default event.
static void decodeClientBehaviors(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent)
           
static void encodeStyleable(javax.faces.context.ResponseWriter responseWriter, Styleable styleable, String... classNames)
           
static String escapeJavaScript(String javaScript)
          Escapes JavaScript so that it can safely be rendered as string in the browser.
static javax.faces.component.behavior.AjaxBehavior getDefaultAjaxBehavior(javax.faces.component.behavior.ClientBehaviorHolder clientBehaviorHolder)
          Gets the Ajax behavior associated with the default event of the specified client behavior holder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RendererUtil

public RendererUtil()
Method Detail

addDefaultAjaxBehavior

public static void addDefaultAjaxBehavior(javax.faces.component.behavior.ClientBehaviorHolder clientBehaviorHolder,
                                          String execute,
                                          String process,
                                          String defaultExecute,
                                          String render,
                                          String update,
                                          String defaultRender)
Adds an Ajax behavior to the specified client behavior holder according to its default event. If the Ajax behavior already exists, then this method takes no action.

Parameters:
clientBehaviorHolder - The client behavior holder for which to add an Ajax behavior.
execute - Space delimited list of execute ids. Typically this is the value of the "execute" attribute of a UI component.
process - Space delimited list of process ids. Typically this is the value of the "process" attribute of a UI component.
defaultExecute - The value for execute in case both the execute and process parameters are null.
render - Space delimited list of render ids. Typically this is the value of the "render" attribute of a UI component.
update - Space delimited list of update ids. Typically thi sis the value of the "update" attribute of a UI component.
defaultRender - The value for render in case both the render and process parameters are null.

decodeClientBehaviors

public static void decodeClientBehaviors(javax.faces.context.FacesContext facesContext,
                                         javax.faces.component.UIComponent uiComponent)

encodeStyleable

public static void encodeStyleable(javax.faces.context.ResponseWriter responseWriter,
                                   Styleable styleable,
                                   String... classNames)
                            throws IOException
Throws:
IOException

escapeJavaScript

public static String escapeJavaScript(String javaScript)
Escapes JavaScript so that it can safely be rendered as string in the browser. This method escapes JS according to the recommendations provided in OWASP's Cross Site Scripting (XSS) Prevention Cheat Sheet. Note: escaped JS can only be rendered into certain JS strings. If it is rendered anywhere else, the site will still be vulnerable to XSS. See the link for more details.

Parameters:
javaScript - a JavaScript string which has not been escaped to prevent XSS.
Returns:
an escaped JavaScript string.

getDefaultAjaxBehavior

public static javax.faces.component.behavior.AjaxBehavior getDefaultAjaxBehavior(javax.faces.component.behavior.ClientBehaviorHolder clientBehaviorHolder)
Gets the Ajax behavior associated with the default event of the specified client behavior holder. If not found, then returns null.

Parameters:
clientBehaviorHolder - The client behavior holder that potentially has an Ajax behavior associated with its default event.
Since:
1.1, 2.1, 3.1


Copyright © 2019 Liferay, Inc.. All rights reserved.