Support for Ajax based redirects, and modal view states.
This commit is contained in:
@@ -35,6 +35,8 @@ public class AjaxViewRoot extends DelegatingViewRoot {
|
||||
|
||||
protected static final String FORM_RENDERED = "formRendered";
|
||||
|
||||
protected static final String PROCESS_ALL = "*";
|
||||
|
||||
private List events = new ArrayList();
|
||||
|
||||
private String[] processIds;
|
||||
@@ -150,8 +152,12 @@ public class AjaxViewRoot extends DelegatingViewRoot {
|
||||
private void processRequestParams(FacesContext context) {
|
||||
|
||||
String processIdsParam = (String) context.getExternalContext().getRequestParameterMap().get(PROCESS_IDS_PARAM);
|
||||
processIds = StringUtils.delimitedListToStringArray(processIdsParam, ",", " ");
|
||||
processIds = removeNestedChildren(context, processIds);
|
||||
if (StringUtils.hasText(processIdsParam) && processIdsParam.contains("*")) {
|
||||
processIds = new String[] { context.getViewRoot().getClientId(context) };
|
||||
} else {
|
||||
processIds = StringUtils.delimitedListToStringArray(processIdsParam, ",", " ");
|
||||
processIds = removeNestedChildren(context, processIds);
|
||||
}
|
||||
|
||||
String renderIdsParam = (String) context.getExternalContext().getRequestParameterMap().get(RENDER_IDS_PARAM);
|
||||
renderIds = StringUtils.delimitedListToStringArray(renderIdsParam, ",", " ");
|
||||
|
||||
@@ -59,7 +59,7 @@ public class JsfUtils {
|
||||
}
|
||||
|
||||
public static boolean isAsynchronousFlowRequest() {
|
||||
if (isFlowRequest() && RequestContextHolder.getRequestContext().getRequestParameters().contains("ajaxSource")) {
|
||||
if (isFlowRequest() && RequestContextHolder.getRequestContext().getExternalContext().isAjaxRequest()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@@ -118,7 +118,7 @@ public class JsfViewFactory implements ViewFactory {
|
||||
}
|
||||
|
||||
private JsfView createJsfView(UIViewRoot root, Lifecycle lifecycle, RequestContext context) {
|
||||
if (JsfUtils.isAsynchronousFlowRequest()) {
|
||||
if (context.getExternalContext().isAjaxRequest()) {
|
||||
return new JsfView(new AjaxViewRoot(root), lifecycle, context);
|
||||
} else {
|
||||
return new JsfView(root, lifecycle, context);
|
||||
|
||||
Reference in New Issue
Block a user