We have written a custom FlowHandlerAdapter that is capable of handling Portlet 2.0 Events.
We want, in the handleEvent method, to read the current flowExecutionKey like
The problem is the following:
String currentFlowExecutionKey = getFlowUrlHandler().getFlowExecutionKey(request);
If the portlet is on its first view. This means the first view has been rendered, but no action has been executed (i.e. no button has been pressed). It does not make any difference if I reload (F5) the page multiple times.
When the portlet receives the event request now, the returned flowExecutionKey is null.
The reason is that the flowExecutionKey is stored within the session and the DefaultFlowUrlHandler.getFlowExecutionKey(PortletR equest request) method cannot return the key from the session when it is in the event-phase because the session is only read during the render phase (check for render request).
Due to the fact that the key is only within the session and not within the request, the method returns null.
The strange thing, for us, is that when we execute any action. From then on it works. Means from then on the flowExecutionKey is stored within the request where it can be accessed also from the event-phase.
So our questions are:
- Why is the key null on the first page?
- What happens on an action, that the key is available within the request afterwards?
- Is this a bug? Shouldn't it be possible to get the key from the session also in the event-phase. If not, what's our mistake we make?
We are very looking forward to any hints.