use of org.jboss.weld.module.jsf.FacesUrlTransformer in project core by weld.
the class ConversationPropagationFilter method wrapResponse.
private ServletResponse wrapResponse(HttpServletResponse response, final String requestPath) {
return new HttpServletResponseWrapper(response) {
@Override
public void sendRedirect(String path) throws IOException {
FacesContext context = FacesContext.getCurrentInstance();
if (context != null) {
// this is a JSF request
ConversationContext conversationContext = instance(contextId).select(HttpConversationContext.class).get();
if (conversationContext.isActive()) {
Conversation conversation = conversationContext.getCurrentConversation();
if (!conversation.isTransient()) {
path = new FacesUrlTransformer(path, context).toRedirectViewId().toActionUrl().appendConversationIdIfNecessary(conversationContext.getParameterName(), conversation.getId()).encode();
}
}
}
super.sendRedirect(path);
}
};
}
Aggregations