[ 
https://issues.apache.org/jira/browse/TOMAHAWK-1331?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12632351#action_12632351
 ] 

Leonardo Uribe commented on TOMAHAWK-1331:
------------------------------------------


The method getContext is ok. The behavior that causes problem is this:

On MyfacesGenericPortlet (myfaces-impl 1.1) and the portlet bridge used by 
Romain, the FacesContext instance for portlets is created in this way

    protected FacesContext facesContext(PortletRequest request,
                                        PortletResponse response)
    {
        return facesContextFactory.getFacesContext(portletContext,
                                                   request,
                                                   response,
                                                   lifecycle);
    }

But on myfaces portlet bridge (for jsf 1.2) do this 
(org.apache.myfaces.portlet.faces.bridge.BridgeImpl line 240):

    try
    {
      // Get the FacesContext instance for this request
      context = 
          getFacesContextFactory().getFacesContext(mPortletConfig, request, 
response, getLifecycle());

both return on getContext() correctly, but since the changes was tested against 
portlet bridge, the first case was not covered.

On TomahawkFacesContextFactory, we need a way to know when the request comes 
from portlets or not, but we don't have an instance of ExternalContext yet, so 
the original method ExternalContextUtils.getRequestType(ExternalContext 
externalContext) can't be used.



> ExternalContextUtils.getRequestType() doesn't work in a portlet environment
> ---------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1331
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1331
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Portlet_Support
>    Affects Versions: 1.1.7
>         Environment: WebSphere Portal 6.0
> MyFaces 1.1.6
> Tomahawk 1.1.7
> Portals Bridges 1.0.4
>            Reporter: Romain Seguy
>         Attachments: TOMAHAWK-1331.log, TOMAHAWK-1331.patch
>
>
> ExternalContextUtils.getRequestType(Object config, Object request) signature 
> doesn't correspond to what's used in 
> TomahawkFacesContextFactory.getFacesContext(): The called method requires a 
> config and a request while it's invoked using a context and a request.
> ==> This always leads to a ClassCastException at 
> TomahawkFacesContextFactory.getFacesContext()#64.
> The invoked method seems to have to be fixed something like this:
> class ExternalContextUtils:
> public static final RequestType getRequestType(Object context, Object 
> request) {
>         if(_PORTLET_CONTEXT_CLASS != null)
>         {
>             if (_PORTLET_CONTEXT_CLASS.isInstance(context))
>             {
>                 // blablabla
> }

-- 
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