[ 
https://issues.apache.org/jira/browse/MYFACES-1877?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Leonardo Uribe updated MYFACES-1877:
------------------------------------

    Resolution: Invalid
      Assignee: Leonardo Uribe
        Status: Resolved  (was: Patch Available)

After testing several combinations like this:

<%
request.getRequestDispatcher("/home.jsf").include(request,response);
%>

of this

<jsp:include page="home.jsf">

or this

<jsp:include page="faces/home.jsp">

It was evident that all this operations are invalid. In other words it is not 
valid to include jsf pages from "outside" jsf using servlet/jsp include. The 
reason why DefaultViewHandlerSupport.getFacesServletMapping(FacesContext) uses 
externalContext.getRequestPathInfo()/getRequestServletPath() is that it is 
supposed the "main" page is a jsf page. 

I tried add this proposed code but jsp compiler throws FileNotFoundException, 
because it uses javax.servlet.include.servlet_path and 
javax.servlet.include.path_info to derive the uri to find the .jsp file used.

> DefaultViewHandlerSupport does not use the servlet path and path info request 
> attributes when processing a Servlet/JSP include
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-1877
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1877
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 1.2.3
>            Reporter: Mathieu Vézeau
>            Assignee: Leonardo Uribe
>         Attachments: patch.txt
>
>
> When MyFaces is processing a Servlet/JSP include, the method 
> DefaultViewHandlerSupport.getFacesServletMapping() does not take into account 
> the servlet path and path info that are passed as request attributes (namely, 
> javax.servlet.include.servlet_path and javax.servlet.include.path_info). 
> Instead, the method takes the values directly from 
> externalContext.getRequestServletPath() and 
> externalContext.getRequestPathInfo(), ignoring the request attributes that 
> could overwrite them. However, these attributes are taken into account when 
> the original view id is calculated (see 
> DefaultRestoreViewSupport.calculateViewId()), so there seems to be a mismatch 
> between these two behaviors.
> As a result, in situations where the servlet path or path info passed as 
> request attributes are different from their original values in the request, 
> MyFaces may not be able to find the appropriate mapping and may also skip the 
> suffix substitution even when it should occur (see 
> DefaultViewHandlerSupport.calculateViewId()). But since the original view id 
> was calculated correctly as explained above, using the attribute overwrites, 
> but the suffix .jsf is not changed to .jsp as it should, it results in an 
> infinite loop as MyFaces keeps calling itself instead of calling the JSP 
> processor.
> The solution is to modify DefaultViewHandlerSupport.getFacesServletMapping() 
> to take into account the servlet path / path info request attributes just 
> like DefaultRestoreViewSupport.calculateViewId() does.

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