Neil Griffin created PLUTO-699:
----------------------------------

             Summary: Spec: Clarify Section 20.3.2 titled "Dependent Scoped 
Beans"
                 Key: PLUTO-699
                 URL: https://issues.apache.org/jira/browse/PLUTO-699
             Project: Pluto
          Issue Type: Bug
          Components: spec
    Affects Versions: 3.0.0
            Reporter: Neil Griffin
            Assignee: Scott Nicklous


Section 20.3.2 of the Portlet 3.0 Spec titled "Dependent Scoped Beans" states:

{quote}The portlet container may produce the beans described in this section as 
@Dependent scoped beans.{quote}

It then provides a table that lists {{namespace}}, {{contextPath}}, 
{{windowId}}, and {{portletName}} as EL names for injectable artifacts of type 
{{java.lang.String}}.

This issue serves as a task for:

1. Changing the word "may" to "must" because injecting an artifact of type 
{{java.lang.String}} can only be done with {{@Dependent}} scope since it is not 
possible for CDI to proxy {{final}} types like {{java.lang.String}}.

2. Clarify that these artifacts are inherently {{@PortletRequestScoped}}, and 
therefore cannot be injected into a portlet bean since there is no request 
thread available at the time CDI creates instances of portlet beans. Instead, 
ask the TCK itself tests in PortletRequestScopedArtifacts.java (annotated with 
{{@PortletRequestScoped}}), these String-based artifacts can only be used from 
within a bean that is proxied. For example:

{code:java|title=MyGenericPortlet.java}
@ApplicationScoped
@PortletConfiguration(portletName="myBeanPortlet")
public class MyBeanPortlet {

    @RenderMethod
    public void myRender(RenderRequest renderRequest, RenderResponse 
renderResponse) {

        
renderResponse.getWriter().write(fooBean.getDependentScopedContextPath());
    }

    @Inject FooBean fooBean;
}

@PortletRequestScoped
public class FooBean {

    public String getDependentScopedContextPath() {
        return contextPath;
    }

    @Inject @ContextPath contextPath;
}
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to