In my examples I have a phase listener that outputs all request parameters . I
accidentially did this before restore view and got some strange behaviour. With
MyFaces 2.0, reading the request parameters before the restore view phase kills
german umlauts. This happens because the character encoding is calculated and
set in the request at the beginning of restore view but after the before phase
listeners are executed.
As this is not happening with Mojarra, I set a breakpoint in
ServletRequest.setCharacterEncoding and saw that they are setting this somewhere
at the beginning of the lifecycle.
The spec says the following about this problem:
*) Spec section 2.2.1: "The JSF implementation must perform the following tasks
during the Restore View phase of the request processing lifecycle: Call
initView() on the ViewHandler. This will set the character encoding properly for
this request. ....."
*) Spec section 7.5.1: "The initView() method must be called as the first method
in the implementation of the Restore View Phase of the request processing
lifecycle, immediately after checking for the existence of the FacesContext
In my understanding, the phase listeners belong to the lifecycle and not to the
phases. This would mean that according to the spec ViewHandler.initView() should
be called AFTER the invocation of the before phase listeners, which is too late.