[ 
https://issues.apache.org/jira/browse/TRINIDAD-1376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12667586#action_12667586
 ] 

Felix Röthenbacher commented on TRINIDAD-1376:
----------------------------------------------

The problem was that the RequestContext was not properly re-created. 
beginRequest() did not correctly initialize and attach a new RequestContext 
because RequestType.getType() returned still PORTAL_ACTION (saved and restored 
by the portlet bridge). After solving this by adding the  
@ExcludeFromManagedRequestScope annotation to the RequestType class another 
problem appeared. Attaching a RequestContext (GlobalConfiguratorImpl:448) used 
a cached RequestContext  from the former action phase found in the request map 
(GlobalConfiguratorImpl:447) (saved and restored by the portlet-bridge). Adding 
the same annotation solved this problem.

I'll provide a patch for these two classes.

A first (cumbersome) approach was to add the following to your faces-config.xml:

<faces-config>
  <application>
    <application-extension>
      <bridge:excluded-attributes>
        
<bridge:excluded-attribute>org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl.REQUEST_TYPE</bridge:excluded-attribute>
        
<bridge:excluded-attribute>org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl.REQUEST_CONTEXT</bridge:excluded-attribute>
      </bridge:excluded-attributes>
    </application-extension>
  </application>
</faces-config>

This would have forced all Trinidad / portal users to add this to 
faces-config.xml.

Just to put this down somewhere: there is a typo in the portlet bridge spec (a 
't' missing):

<bridge:excluded-atribute>myFacesExtension.state.*</bridge:excluded-attribute>

Should be

<bridge:excluded-attribute>myFacesExtension.state.*</bridge:excluded-attribute>


> NullPointerException because RequestContext released after action request.
> --------------------------------------------------------------------------
>
>                 Key: TRINIDAD-1376
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1376
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Portlet
>    Affects Versions:  1.2.11-core
>            Reporter: Felix Röthenbacher
>            Assignee: Scott O'Bryan
>
> RequestContext is released after action request which results in a 
> NullPointerException in the following render request.
> The problem is in the method GlobalConfiguratorImpl.endRequest(final 
> ExternalContext externalContext)
> Calling _releaseRequestContext(externalContext); removes the RequestContext 
> from ThreadLocal.
> Any subsequent calls to RequestContext.getCurrentInstance() return null which 
> breaks the render request.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to