Hi community,
I have the follow code for retrieving data from Flowscope (which works fine) used in an MVC Controller:
My question is: Why do I need to set ExternalContextHolder (not using it throws NPE)? Is it safe knowing that a controller instance can attend many requests simultaneously? what are the implications of those lines of code setting a context?Code:protected Object getElementFromFlowScope(String flowKey, HttpServletRequest req, String elementKey) { ExternalContextHolder.setExternalContext(new ServletExternalContext(getServletContext(), req, null)); FlowExecutionRepository executionRepository = ((FlowExecutorImpl) getFlowExecutor()).getExecutionRepository(); FlowExecution flowExecution = executionRepository.getFlowExecution(executionRepository.parseFlowExecutionKey(flowKey)); FlowSession flowSession = flowExecution.getActiveSession(); Object element = flowSession.getScope().get(elementKey); ExternalContextHolder.setExternalContext(null); return element; }
I use SWF 2.0.5
Thanks.


Reply With Quote
