[weld-issues] [JBoss JIRA] (WELD-909) Dual faces mapping and cid parameter for conversational redirect

Marko Lukša (JIRA) jira-events at lists.jboss.org
Mon Mar 19 08:56:47 EDT 2012


     [ https://issues.jboss.org/browse/WELD-909?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marko Lukša updated WELD-909:
-----------------------------

    Git Pull Request: https://github.com/weld/core/pull/183


Fixed.

The problem was in FacesUrlTransformer.toActionUrl(), where the original url already contained the cid parameter. As a result, {{queryParameters}} also contained the parameter. Furthermore, {{actionUrl}} (obtained by calling {{getActionURL()}}) also contained the cid parameter. Since {{actionUrl}} and {{queryParameters}} are simply concatenated, the resulting url will contain the dual cid parameters.

I should probably have parsed both query strings and merged them parameter-by-parameter, but this would be overkill and could have possibly introduced new bugs (because of the parsing and then rebuilding the query string). I opted for a simpler solution, since {{actionUrl}} will only contain the cid parameter (and no other parameters) in all but the most exotic cases. So if {{actionUrl}}'s query string is fully contained in {{queryParameters}}, I simply ignore it and use {{queryParameters}} instead. 


                
> Dual faces mapping and cid parameter for conversational redirect
> ----------------------------------------------------------------
>
>                 Key: WELD-909
>                 URL: https://issues.jboss.org/browse/WELD-909
>             Project: Weld
>          Issue Type: Bug
>          Components: Conversations
>    Affects Versions: 1.1.1.Final
>            Reporter: Nicklas Karlsson
>            Assignee: Marko Lukša
>
> Given a page like
> {code}
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml"
> 	xmlns:ui="http://java.sun.com/jsf/facelets"
> 	xmlns:h="http://java.sun.com/jsf/html"
> 	xmlns:f="http://java.sun.com/jsf/core">
> <h:head>
> 	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
> 	<title>Concept</title>
> </h:head>
> <h:body>
> 	<f:view>
> 		<h:form>
> 			<h:commandButton value="redirect" action="page?faces-redirect=true"/>
> 			<h:commandButton value="non-transient" action="#{backingBean.nonTransient}"/>
> 		</h:form>
> 	</f:view>
> </h:body>
> </html>
> {code}
> and a backing bean like
> {code}
> package fi.nik.concept;
> import javax.enterprise.context.Conversation;
> import javax.inject.Inject;
> import javax.inject.Named;
> @Named
> public class BackingBean 
> {
> 	@Inject
> 	private Conversation conversation;
> 	public String nonTransient() 
> 	{
> 		conversation.begin();
> 		return "page?faces-redirect=true";
> 	}
> }
> {code}
> clicking "redirect" with non-transient conversations work fine but clicking "non-transient" duplicates the faces mappings and cid to something like http://localhost:8080/concept/faces/faces/page.xhtml?cid=1&cid=1 and clicking "redirect" after keeps the URL like that.
> It works normally after that (since the faces mapping is still hit and the cid is repeated with the same value) but it looks a bit odd.
> Would have written a test for it but git on Windows is... a bit nonlinear at times.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the weld-issues mailing list