Issue Details (XML | Word | Printable)

Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: michael_kurz
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.

ViewHandler.initView() called too late

Created: 28/May/10 01:33 AM   Updated: 19/Dec/13 10:51 PM
Component/s: Lifecycle
Affects Version/s: 2.0
Fix Version/s: 2.3

Time Tracking:
Not Specified


Operating System: All
Platform: All

Issuezilla Id: 816
Status Whiteboard:

size_medium importance_medium

Participants: Ed Burns, michael_kurz and rogerk

 Description  « Hide

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.