[weld-issues] [JBoss JIRA] Issue Comment Edited: (WELD-549) Conversation propagated by default with h:link

Marcel Kolsteren (JIRA) jira-events at lists.jboss.org
Thu Sep 16 15:37:28 EDT 2010


    [ https://jira.jboss.org/browse/WELD-549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12551378#action_12551378 ] 

Marcel Kolsteren edited comment on WELD-549 at 9/16/10 3:36 PM:
----------------------------------------------------------------

Some more analysis. The JSF 2.0 version of the ViewHandler class has two new methods for generating bookmarkable and redirect URLs, which are not in JSF 1.2. In JSF 2.0, the four cases of my previous post map to the following ViewHandler methods:

1. getActionURL
2. getBookmarkableURL
3. getActionURL
4. getRedirectURL

Remark that in Mojorra's view handler implementation (MultiViewHandler), both getBookmarkableURL and getRedirectURL call getActionURL on the installed view handler. That's why Dan could cover all four cases, by only overriding the getActionURL method (I hope this is portable to other JSF implementations).

How to prevent that getBookmarkableURL adds the cid parameter? I think that a solution would be to change ConversationAwareViewHandler so that it not only overrides getActionURL, but also getBookmarkableURL. This override could be a copy of MultiViewHandler.getBookmarkableURL, where getActionURL is called on the delegate instead of on the installed view handler.

Unfortunately, there is a difficulty: the Weld core is built against the JSF 1.2 API, which doesn't contain the getBookmarkableURL method, so how to override it?

      was (Author: marcelkolsteren):
    Some more analysis. The JSF 2.0 version of the ViewHandler class has two new methods for generating bookmarkable and redirect URLs, which are not in JSF 1.2. In JSF 2.0, the four cases of my previous post map to the following ViewHandler methods:

1. getActionURL
2. getBookmarkableURL
3. getActionURL
4. getRedirectURL

Remark that in Mojorra's view handler implementation (MultiViewHandler), both getBookmarkableURL and getRedirectURL call getActionURL on the installed view handler. That's why Dan could cover all four cases, by only overriding the getActionURL method (I hope this is portable to other JSF implementations).

How to prevent that getBookmarkableURL adds the cid parameter? I think that a solution would be to change ConversationAwareViewHandler so that it not only overrides getActionURL, but also getBookmarkableURL. The ConversationAwareViewHandler could be a copy of MultiViewHandler.getBookmarkableURL, where getActionURL is called on the delegate instead of on the installed view handler.

Unfortunately, there is a difficulty: the Weld core is built against the JSF 1.2 API, which doesn't contain the getBookmarkableURL method, so how to override it?
  
> Conversation propagated by default with h:link
> ----------------------------------------------
>
>                 Key: WELD-549
>                 URL: https://jira.jboss.org/browse/WELD-549
>             Project: Weld
>          Issue Type: Bug
>          Components: Web Tier integration (JSF, JSP, EL and Servlet) 
>    Affects Versions: 1.0.1.Final
>         Environment: GlassFish Server Open Source Edition 3.0.1 on Mac OS 10.6 and Windows 7. WELD-000900 1.0.1 (SP2)
>            Reporter: David Beaumont
>            Priority: Critical
>             Fix For: 1.1.0.Beta2
>
>         Attachments: CdiConvoBug.war
>
>
> I created a long running conversation by running a method on a conversation scoped bean:
> private boolean initialized;
> public void init() {
> 	if(initialized) return;
> 	conversation.begin();
> 	initialized = true;
> }
> From a facelets page using the JSF2 event system:
> <f:metadata>
> 	<f:event type="preRenderView" listener="#{convoBean.init}" />
> </f:metadata>
> If a conversation has been made long-running, the h:link tag will produce links with the conversation query parameter, thereby propagating the conversation whether that was what you wanted or not.
> I.e:
> <p>Link: <h:link outcome="page2.xhtml" value="a link" /></p>
> produces
> <p>Link: <a href="/CdiConvoBug/page2.jsf?cid=3">a link</a></p>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the weld-issues mailing list