/** * Returns a list of all action expressions and listeners associated with given component. This covers expressions * in <code>action</code> attribute of command components and <code>listener</code> attribute of ajax components. * Any method expressions are in format <code>#{bean.method}</code> and any action listeners are added as fully * qualified class names. This list is primarily useful for logging postback actions in a phase listener. You can * use {@link #getCurrentActionSource()} to obtain the current action source. * @param component The component to retrieve all action expressions and listeners from. * @return A list of all action expressions and listeners associated with given component. * @since 2.4 */ public static List<String> getActionExpressionsAndListeners(UIComponent component) { List<String> actions = new ArrayList<>(); if (component instanceof ActionSource2) { ActionSource2 source = (ActionSource2) component; addExpressionStringIfNotNull(source.getActionExpression(), actions); for (ActionListener actionListener : source.getActionListeners()) { actions.add(actionListener.getClass().getName()); } } if (component instanceof ClientBehaviorHolder) { String behaviorEvent = getRequestParameter(BEHAVIOR_EVENT_PARAM_NAME); if (behaviorEvent != null) { for (BehaviorListener listener : getBehaviorListeners((ClientBehaviorHolder) component, behaviorEvent)) { addExpressionStringIfNotNull(getField(listener.getClass(), MethodExpression.class, listener), actions); } } } return unmodifiableList(actions); }
/** * Returns a list of all action expressions and listeners associated with given component. This covers expressions * in <code>action</code> attribute of command components and <code>listener</code> attribute of ajax components. * Any method expressions are in format <code>#{bean.method}</code> and any action listeners are added as fully * qualified class names. This list is primarily useful for logging postback actions in a phase listener. You can * use {@link #getCurrentActionSource()} to obtain the current action source. * @param component The component to retrieve all action expressions and listeners from. * @return A list of all action expressions and listeners associated with given component. * @since 2.4 */ public static List<String> getActionExpressionsAndListeners(UIComponent component) { List<String> actions = new ArrayList<>(); if (component instanceof ActionSource2) { ActionSource2 source = (ActionSource2) component; addExpressionStringIfNotNull(source.getActionExpression(), actions); for (ActionListener actionListener : source.getActionListeners()) { actions.add(actionListener.getClass().getName()); } } if (component instanceof ClientBehaviorHolder) { String behaviorEvent = getRequestParameter(BEHAVIOR_EVENT_PARAM_NAME); if (behaviorEvent != null) { for (BehaviorListener listener : getBehaviorListeners((ClientBehaviorHolder) component, behaviorEvent)) { addExpressionStringIfNotNull(getField(listener.getClass(), MethodExpression.class, listener), actions); } } } return unmodifiableList(actions); }