[
https://issues.apache.org/jira/browse/OWB-168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12778819#action_12778819
]
Sven Linstaedt commented on OWB-168:
------------------------------------
If have written a short fix, using a ViewHandler instead of a Filter to attach
CID the above cases. Just remove the org.apache.webbeans.jsf.WebBeansJSFFilter
from web.xml and add an appropiate entry to faces-config.xml to test this
handler.
public class ConversationAwareViewHandler extends ViewHandlerWrapper
{
private final ViewHandler delegate;
public ConversationAwareViewHandler(ViewHandler delegate)
{
this.delegate = delegate;
}
/**
* {...@inheritdoc}
*/
@Override
public String getActionURL(FacesContext context, String viewId)
{
String url = delegate.getActionURL(context, viewId);
Conversation conversation = lookupConversation();
if (conversation != null && !conversation.isTransient())
{
url = JSFUtil.getRedirectViewIdWithCid(url,
conversation.getId());
}
return url;
}
/**
* {...@inheritdoc}
*/
@Override
public ViewHandler getWrapped()
{
return delegate;
}
private Conversation lookupConversation()
{
BeanManager beanManager = BeanManagerImpl.getManager();
if (beanManager == null)
{
return null;
}
Set<Bean<?>> beans = beanManager.getBeans(Conversation.class,
new AnnotationLiteral<Default>() {});
if (beans.isEmpty())
{
return null;
}
@SuppressWarnings("unchecked")
Bean<Conversation> conversationBean = (Bean<Conversation>)
beans.iterator().next();
CreationalContext<Conversation> creationalContext =
beanManager.createCreationalContext(conversationBean);
Conversation conversation =
(Conversation)
beanManager.getReference(conversationBean, Conversation.class,
creationalContext);
return conversation;
}
}
> cid parameter is not propagated for redirects caused by ajax requests and on
> <h:link/>
> --------------------------------------------------------------------------------------
>
> Key: OWB-168
> URL: https://issues.apache.org/jira/browse/OWB-168
> Project: OpenWebBeans
> Issue Type: Bug
> Components: Context and Scopes
> Reporter: Sven Linstaedt
> Assignee: Gurkan Erdogdu
>
> Instead of using a servlet filter I suggest using a ViewHandler delegate,
> which oberrides getActionURL and getRedirectURL and attaches the cid, because
> Filter.sendRedirect() is not called reliable.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.