Seam adds unwanted conversationId to URL
mvdvlies Jan 12, 2009 10:32 AMI'm doing a project in seam that requires restful URLs. I have a view that is mapped to /group/{group}/{locale}. On that page I have a list of so called messages. Each message has a button to save changes to the message. This is linked to an action bean like this:
<h:commandButton type="submit" value="Save Changes" action="#{groupAction.update}" />
Each message has an anchor, so /group/{group}/{locale}#{id} can be used to make the browser go to that anchor. This is why I need a redirect after the POST:
<page view-id="/group.xhtml"> <rewrite pattern="/group/{group}/{locale}"/> <param name="group" value="#{groupAction.group}"/> <param name="locale" value="#{groupAction.locale}"/> <navigation from-action="#{groupAction.update}"> <redirect view-id="/group.xhtml?group=#{group}&locale=#{locale}##{id}"/> </navigation> </page>
Also I have the following redirect rule (UrlRewriteFilter) to get to the proper RESTful URL:
<outbound-rule> <from>^/group.xhtml\?group=([\.\w]+)&locale=([\.\w]+)\#([\.\w]+)\?cid=(\d*)$</from> <to type="temporary-redirect" last="true">/group/$1/$2#$3</to> </outbound-rule>
I try to strip the conversationId here. This has been tested an works. However seam still appends a ?conversationId={cid}. So what's the problem? Well, imagine a URL like /group/{group}/{locale}#{id}?conversationId={cid}. Oviously the browser doesn't like this and will not automatically go to that anchor.
I did some research and discovered my problem in the seam documentation:
29.1.4.2. Conversation propagation with redirects
This filter allows Seam to propagate the conversation context across browser redirects. It intercepts any browser redirects and adds a request parameter that specifies the Seam conversation identifier. The redirect filter will process all requests by default, but this behavior can also be adjusted in components.xml:
<web:redirect-filter url-pattern="*.seam"/>
So I disabled the filter using the following snippet in my components.xml:
<web:redirect-filter disabled="true" installed="false" />
However I still get the ?conversationID={cid} on the URL.