I guess it wasn't quite as similar as I thought back in 1.0-maintenance

This commit is contained in:
Ben Hale
2007-06-12 20:50:47 +00:00
parent 3fbabf2b90
commit 5971f42648
2 changed files with 3 additions and 18 deletions

View File

@@ -25,7 +25,6 @@ import javax.servlet.http.HttpServletResponse;
import org.springframework.web.filter.OncePerRequestFilter;
import org.springframework.webflow.context.ExternalContextHolder;
import org.springframework.webflow.execution.FlowExecutionContextHolder;
/**
* A servlet filter used to guarantee that webflow context information is
@@ -48,15 +47,13 @@ public class FlowSystemCleanupFilter extends OncePerRequestFilter {
/**
* Cleans up the current flow execution in the request context if necessary.
* Specifically, handles unlocking the execution if necessary, setting the
* holder to null, and cleaning up the flow execution context thread local.
* Can be safely called even if no execution is bound or one is bound but
* not locked.
* Specifically, handles unlocking the execution if necessary and setting the
* holder to null. Can be safely called even if no execution is bound or one
* is bound but not locked.
* @param request the servlet request
*/
private void cleanupCurrentFlowExecution(ServletRequest request) {
if (isFlowExecutionRestored(request)) {
FlowExecutionContextHolder.setFlowExecutionContext(null);
getFlowExecutionHolder(request).unlockFlowExecutionIfNecessary();
request.removeAttribute(getFlowExecutionHolderKey());
}

View File

@@ -14,7 +14,6 @@ import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.webflow.context.ExternalContextHolder;
import org.springframework.webflow.engine.impl.FlowExecutionImpl;
import org.springframework.webflow.execution.FlowExecutionContextHolder;
import org.springframework.webflow.test.MockExternalContext;
public class FlowSystemCleanupFilterTests extends TestCase {
@@ -33,7 +32,6 @@ public class FlowSystemCleanupFilterTests extends TestCase {
request.setAttribute(getFlowExecutionHolderKey(), new FlowExecutionHolder(new FlowExecutionImpl()));
response = new MockHttpServletResponse();
chain = new MockFilterChain();
FlowExecutionContextHolder.setFlowExecutionContext(new FlowExecutionImpl());
ExternalContextHolder.setExternalContext(new MockExternalContext());
}
@@ -41,11 +39,6 @@ public class FlowSystemCleanupFilterTests extends TestCase {
filter.doFilter(request, response, chain);
assertNull("Should have cleaned up the flow execution", request.getAttribute(getFlowExecutionHolderKey()));
try {
FlowExecutionContextHolder.getFlowExecutionContext();
fail("Should have an empty holder");
} catch (IllegalStateException e) {
}
try {
ExternalContextHolder.getExternalContext();
fail("Should have an empty holder");
@@ -58,11 +51,6 @@ public class FlowSystemCleanupFilterTests extends TestCase {
filter.doFilter(request, response, new ExceptionThrowingMockFilterChain());
} catch (RuntimeException e) {
assertNull("Should have cleaned up the flow execution", request.getAttribute(getFlowExecutionHolderKey()));
try {
FlowExecutionContextHolder.getFlowExecutionContext();
fail("Should have an empty holder");
} catch (IllegalStateException e1) {
}
try {
ExternalContextHolder.getExternalContext();
fail("Should have an empty holder");