Is it possible to use an action-state as the start-state of a flow, and write to the output stream never reaching a view-state? I'm getting these exceptions "java.lang.IllegalStateException: The key for the flow execution is null; make sure the key is assigned first", and I think it may be related to never rendering a view in a view-state.
This is the situation: I have a requirement to open a new window and show some dynamically generated binary content (pdf, xls, or others). I've done this on other flows using Action-state + AbstractAction as described in the reference (Streaming Actions). As it seems that it's difficult opening windows from within a flow and writing to that stream, I start a new flow that uses the "Action-state + AbstractAction" method:
<action-state id="a_document" >
<!-- Returns a success() to "force" getting into the transition -->
The action gets called, it writes to the HttpServletResponse without errors, and it tries to execute the transition. The transition doesn't have a to="" because the action has already written and completed the response and I thought this would be enough. Server log:
[org.springframework.webflow.execution.ActionExecutor] Finished executing [EvaluateAction@fc3629 expression = showDocumentAction, resultExposer = [null]]; result = success
[org.springframework.webflow.engine.Transition] Executing [Transition@503538 on = success, to = [null]]
[org.springframework.web.servlet.DispatcherServlet] Could not complete request
java.lang.IllegalStateException: The key for the flow execution is null; make sure the key is assigned first. Execution Details = [FlowExecutionImpl@1d60121 flow = 'documentResultat', flowSessions = list[[FlowSessionImpl@e43e44 flow = 'documentResultat', state = 'a_document', scope = map[[empty]]]]]
Adding a view-state that gets to the action-state using an action in a commandbutton solves the problem, but I would like the content to appear directly in the window.
I'll really appreciate any help or different approaches to this requirement.