polish
This commit is contained in:
@@ -207,6 +207,6 @@ public interface ExternalContext {
|
||||
* @see #requestFlowDefinitionRedirect(String, MutableAttributeMap)
|
||||
* @see #requestExternalRedirect(String)
|
||||
*/
|
||||
public boolean isRedirectRequested();
|
||||
public boolean isRedirectResponseComplete();
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user