cachSeconds = 0
This commit is contained in:
@@ -21,10 +21,13 @@ import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.js.mvc.servlet.AjaxHandler;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.AbstractController;
|
||||
import org.springframework.web.servlet.mvc.Controller;
|
||||
import org.springframework.webflow.context.servlet.FlowUrlHandler;
|
||||
import org.springframework.webflow.executor.FlowExecutor;
|
||||
|
||||
@@ -36,24 +39,24 @@ import org.springframework.webflow.executor.FlowExecutor;
|
||||
*
|
||||
* @author Keith Donald
|
||||
*/
|
||||
public class FlowController extends AbstractController implements InitializingBean {
|
||||
public class FlowController implements Controller, ApplicationContextAware, InitializingBean {
|
||||
|
||||
private FlowHandlerAdapter flowHandlerAdapter = new FlowHandlerAdapter();
|
||||
|
||||
private Map flowHandlers = new HashMap();
|
||||
|
||||
private boolean customFlowHandlerAdapter;
|
||||
private boolean customFlowHandlerAdapterSet;
|
||||
|
||||
/**
|
||||
* Creates a new flow controller.
|
||||
* @see #setFlowExecutor(FlowExecutor)
|
||||
* @see #setFlowUrlHandler(FlowUrlHandler)
|
||||
* @see #setAjaxHandler(AjaxHandler)
|
||||
* @see #setFlowHandlerAdapter(FlowHandlerAdapter)
|
||||
* @see #afterPropertiesSet()
|
||||
*/
|
||||
public FlowController() {
|
||||
// turn caching off for flows by default
|
||||
setCacheSeconds(0);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,20 +135,24 @@ public class FlowController extends AbstractController implements InitializingBe
|
||||
*/
|
||||
public void setFlowHandlerAdapter(FlowHandlerAdapter flowHandlerAdapter) {
|
||||
this.flowHandlerAdapter = flowHandlerAdapter;
|
||||
customFlowHandlerAdapter = true;
|
||||
customFlowHandlerAdapterSet = true;
|
||||
}
|
||||
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
if (!customFlowHandlerAdapterSet) {
|
||||
flowHandlerAdapter.setApplicationContext(applicationContext);
|
||||
}
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
if (!customFlowHandlerAdapter) {
|
||||
flowHandlerAdapter.setApplicationContext(getApplicationContext());
|
||||
if (!customFlowHandlerAdapterSet) {
|
||||
flowHandlerAdapter.afterPropertiesSet();
|
||||
}
|
||||
}
|
||||
|
||||
// subclassing hooks
|
||||
|
||||
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
|
||||
throws Exception {
|
||||
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
FlowHandler handler = getFlowHandler(request);
|
||||
return flowHandlerAdapter.handle(request, response, handler);
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@ import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.js.mvc.servlet.AjaxHandler;
|
||||
import org.springframework.js.mvc.servlet.SpringJavascriptAjaxHandler;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.web.context.support.WebApplicationObjectSupport;
|
||||
import org.springframework.web.servlet.HandlerAdapter;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.support.WebContentGenerator;
|
||||
import org.springframework.webflow.context.servlet.DefaultFlowUrlHandler;
|
||||
import org.springframework.webflow.context.servlet.FlowUrlHandler;
|
||||
import org.springframework.webflow.context.servlet.ServletExternalContext;
|
||||
@@ -51,7 +51,7 @@ import org.springframework.webflow.executor.FlowExecutor;
|
||||
*
|
||||
* @author Keith Donald
|
||||
*/
|
||||
public class FlowHandlerAdapter extends WebApplicationObjectSupport implements HandlerAdapter, InitializingBean {
|
||||
public class FlowHandlerAdapter extends WebContentGenerator implements HandlerAdapter, InitializingBean {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(FlowHandlerAdapter.class);
|
||||
|
||||
@@ -86,6 +86,8 @@ public class FlowHandlerAdapter extends WebApplicationObjectSupport implements H
|
||||
* @see #afterPropertiesSet()
|
||||
*/
|
||||
public FlowHandlerAdapter() {
|
||||
// prevent caching of flow pages by default
|
||||
setCacheSeconds(0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,6 +151,7 @@ public class FlowHandlerAdapter extends WebApplicationObjectSupport implements H
|
||||
|
||||
public ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||
throws Exception {
|
||||
checkAndPrepare(request, response, false);
|
||||
FlowHandler flowHandler = (FlowHandler) handler;
|
||||
String flowExecutionKey = flowUrlHandler.getFlowExecutionKey(request);
|
||||
if (flowExecutionKey != null) {
|
||||
|
||||
Reference in New Issue
Block a user