[jsr-314-open-mirror] [jsr-314-open] Proposal [868-DropCURRENT_COMPONENT CURRENT_COMPOSITE_COMPONENT]

Ed Burns edward.burns at oracle.com
Tue Aug 10 15:09:45 EDT 2010


https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=868

Background:

The JSF specification contains the following:

    /**
     * <p class="changed_added_2_0">The key to which the
     * <code>UIComponent</code> currently being processed will be
     * associated with within the {@link FacesContext} attributes map.</p>
     *
     * @see javax.faces.context.FacesContext#getAttributes()
     *
     * @since 2.0
     */
    public static final String CURRENT_COMPONENT = 
"javax.faces.component.CURRENT_COMPONENT";

    /**
     * <p class="changed_added_2_0">The key to which the
     * <em>composite</em> <code>UIComponent</code> currently being
     * processed will be associated with within the {@link FacesContext}
     * attributes map.</p>
     *
     * @see javax.faces.context.FacesContext#getAttributes()
     *
     * @since 2.0
     */
    public static final String CURRENT_COMPOSITE_COMPONENT = 
"javax.faces.component.CURRENT_COMPOSITE_COMPONENT";

The guarantee that the current and current composite components are 
available through FacesContext.getAttributes() doesn't seem right for 
several reasons:
1) It isn't useful.  The static methods 
UIComponent.getCurrentComponent() and 
UIComponent.getCurrentCompositeComponent() are more convenient and typesafe.
2) It is dangerous.  If the values of these attributes is set, the 
current stack will be messed up
3) When we aren't using the particular space-inefficient implementation 
the JSF RI currently uses, maintaining these attributes just in case a 
developer tries to request them is a waste

Proposal

Due to our iron-clad commitment to backwards compatibility, we keep the
public static final String constants, but alter the behavior, providing
a context-param to restore the old behavior.

The constants will only be honored if the context param is set.

Does this sound ok?
-- 
| edburns at oracle.com | office: +1 407 458 0017
| homepage:          | http://ridingthecrest.com/
| 06 work days until JSF 2.1 Milestone 2



More information about the jsr-314-open-mirror mailing list