myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Kitching (JIRA)" <...@myfaces.apache.org>
Subject [jira] Commented: (ORCHESTRA-13) RequestParameterProviderManager fails when template URL includes EL expressions
Date Thu, 06 Dec 2007 09:10:43 GMT

    [ https://issues.apache.org/jira/browse/ORCHESTRA-13?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12548966
] 

Simon Kitching commented on ORCHESTRA-13:
-----------------------------------------

I've done some debugging on this.

After clicking on the "product details" link of the petstore, the stack trace is like this:

RequestParameterProviderManager.encodeAndAttachParameters(String) line: 111	
RequestParameterResponseWrapper.encodeURL(String) line: 42	
ServletExternalContextImpl.encodeActionURL(String) line: 386	
UrlParameterNavigationHandler$1$1(ExternalContextWrapper).encodeActionURL(String) line: 49

RedirectTrackerExternalContextWrapper.encodeActionURL(String) line: 53	
NavigationHandlerImpl.handleNavigation(FacesContext, String, String) line: 93	
RedirectTrackerNavigationHandler.handleNavigation(FacesContext, String, String) line: 40	
UrlParameterNavigationHandler.handleNavigation(FacesContext, String, String) line: 54	
ActionListenerImpl.processAction(ActionEvent) line: 82	

The url parameter is:
   ProductDetail.faces?productId=#{param.productId}
so the encodeAndAttachParameters method then proceeds to stuff the url up.

Here is the point at which the EL expansion is done (later):

UrlParameterNavigationHandler.interceptRedirect(FacesContext, String) line: 91	
UrlParameterNavigationHandler$1$1.redirect(String) line: 62	
RedirectTrackerExternalContextWrapper.redirect(String) line: 222	
NavigationHandlerImpl.handleNavigation(FacesContext, String, String) line: 93	
RedirectTrackerNavigationHandler.handleNavigation(FacesContext, String, String) line: 40	
UrlParameterNavigationHandler.handleNavigation(FacesContext, String, String) line: 54	
ActionListenerImpl.processAction(ActionEvent) line: 82	


In short, the EL expansion only occurs when ExternalContext.sendRedirect is invoked by the
"real" NavigationHandlerImpl. But the navigation handler invokes that only after it thinks
it has built the full url to redirect to, ie after it has called encodeActionUrl. So encodeActionUrl
is always called before EL expansion occurs.

A workaround for JSF12 is probably to use ${...} form EL expressions in navigation cases,
as it is the "#" that is confusing things.

I wonder if the EL expansion can just be moved into the RequestParameterProviderManager...

> RequestParameterProviderManager fails when template URL includes EL expressions
> -------------------------------------------------------------------------------
>
>                 Key: ORCHESTRA-13
>                 URL: https://issues.apache.org/jira/browse/ORCHESTRA-13
>             Project: MyFaces Orchestra
>          Issue Type: Bug
>          Components: RequestParameterProvider
>    Affects Versions: 1.0
>            Reporter: Simon Kitching
>
> As reported by Jonas Esser on the mailing list, a url of form
>   http://foo.example?productId=#{var}
> fails badly; the final url is:
>   http://foo.example?productId=&contextId=1val
> This occurs in the "petstore" orchestra example, when viewing a product's details.
> The problem is that RequestParameterProvidedManager thinks the "#" is a url fragment
marker. Query params go before fragment markers, eg
>   http://foo.example?productId=5#anchor
> does correctly become
>   http://foo.example?productId=5&contextId=1#anchor
> But #{...} is NOT an anchor. In the petstore example, the url can be found in faces-config.xml:
> 	<navigation-case>
> 		<from-outcome>ProductDetails</from-outcome>
> 		<to-view-id>/mops/ProductDetail.jsp?productId=#{param.productId}</to-view-id>
> 		<redirect/>
> 	</navigation-case>

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


Mime
View raw message