This commit is contained in:
Keith Donald
2009-04-06 22:25:50 +00:00
parent 47dc9327ae
commit 6697fb05a1
5 changed files with 18 additions and 13 deletions

View File

@@ -207,6 +207,6 @@ public interface ExternalContext {
* @see #requestFlowDefinitionRedirect(String, MutableAttributeMap)
* @see #requestExternalRedirect(String)
*/
public boolean isRedirectRequested();
public boolean isRedirectResponseComplete();
}

View File

@@ -252,7 +252,7 @@ public class PortletExternalContext implements ExternalContext {
}
public void requestRedirectInPopup() throws IllegalStateException {
if (isRedirectRequested()) {
if (isRedirectResponseComplete()) {
redirectInPopup = true;
} else {
throw new IllegalStateException(
@@ -260,7 +260,7 @@ public class PortletExternalContext implements ExternalContext {
}
}
public boolean isRedirectRequested() {
public boolean isRedirectResponseComplete() {
return getFlowExecutionRedirectRequested() || getFlowDefinitionRedirectRequested()
|| getExternalRedirectRequested();
}

View File

@@ -248,7 +248,7 @@ public class ServletExternalContext implements ExternalContext {
}
public void requestRedirectInPopup() throws IllegalStateException {
if (isRedirectRequested()) {
if (isRedirectResponseComplete()) {
redirectInPopup = true;
} else {
throw new IllegalStateException(
@@ -256,7 +256,7 @@ public class ServletExternalContext implements ExternalContext {
}
}
public boolean isRedirectRequested() {
public boolean isRedirectResponseComplete() {
return getFlowExecutionRedirectRequested() || getFlowDefinitionRedirectRequested()
|| getExternalRedirectRequested();
}

View File

@@ -171,7 +171,7 @@ public class ViewState extends TransitionableState {
context.assignFlowExecutionKey();
ExternalContext externalContext = context.getExternalContext();
if (externalContext.isResponseComplete()) {
clearFlashIfRenderResponse(context);
clearFlashIfNotRedirecting(context);
} else {
if (shouldRedirect(context)) {
context.getExternalContext().requestFlowExecutionRedirect();
@@ -182,6 +182,8 @@ public class ViewState extends TransitionableState {
if (externalContext.isResponseAllowed()) {
View view = viewFactory.getView(context);
render(context, view);
} else {
externalContext.recordResponseComplete();
}
}
}
@@ -200,7 +202,7 @@ public class ViewState extends TransitionableState {
if (!stateExited) {
ExternalContext externalContext = context.getExternalContext();
if (externalContext.isResponseComplete()) {
clearFlashIfRenderResponse(context);
clearFlashIfNotRedirecting(context);
} else {
if (externalContext.isAjaxRequest()) {
renderIfAllowed(context, view);
@@ -216,7 +218,7 @@ public class ViewState extends TransitionableState {
} else {
ExternalContext externalContext = context.getExternalContext();
if (externalContext.isResponseComplete()) {
clearFlashIfRenderResponse(context);
clearFlashIfNotRedirecting(context);
} else {
renderIfAllowed(context, view);
}
@@ -251,8 +253,11 @@ public class ViewState extends TransitionableState {
}
private void renderIfAllowed(RequestControlContext context, View view) throws ViewRenderingException {
if (context.getExternalContext().isResponseAllowed()) {
ExternalContext externalContext = context.getExternalContext();
if (externalContext.isResponseAllowed()) {
render(context, view);
} else {
externalContext.recordResponseComplete();
}
}
@@ -274,8 +279,8 @@ public class ViewState extends TransitionableState {
context.viewRendered(view);
}
private void clearFlashIfRenderResponse(RequestContext context) {
if (context.getExternalContext().isResponseAllowed() && !context.getExternalContext().isRedirectRequested()) {
private void clearFlashIfNotRedirecting(RequestContext context) {
if (!context.getExternalContext().isRedirectResponseComplete()) {
clearFlash(context);
}
}

View File

@@ -183,7 +183,7 @@ public class MockExternalContext implements ExternalContext {
}
public void requestRedirectInPopup() throws IllegalStateException {
if (isRedirectRequested()) {
if (isRedirectResponseComplete()) {
redirectInPopup = true;
} else {
throw new IllegalStateException(
@@ -191,7 +191,7 @@ public class MockExternalContext implements ExternalContext {
}
}
public boolean isRedirectRequested() {
public boolean isRedirectResponseComplete() {
return getFlowExecutionRedirectRequested() || getFlowDefinitionRedirectRequested()
|| getExternalRedirectRequested();
}