Hello,

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:

Code:
<flow xmlns="http://www.springframework.org/schema/webflow"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/webflow
    http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"
    start-state="a_document">
	<action-state id="a_document" >
		<!-- Returns a success() to "force" getting into the transition -->
		<evaluate expression="showDocumentAction.successEvent()"></evaluate>
		<transition on="success">
			<evaluate expression="showDocumentAction"/>
		</transition>		
	</action-state>
</flow>

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:

Code:
[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]]]]]
	at org.springframework.webflow.execution.repository.support.AbstractFlowExecutionRepository.assertKeySet(AbstractFlowExecutionRepository.java:189)
	at org.springframework.webflow.execution.repository.impl.DefaultFlowExecutionRepository.putFlowExecution(DefaultFlowExecutionRepository.java:108)
	at org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:142)
...


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.

Thanks