[jsr-314-open] [jsf2.next] Pluggable VDL handler heavy depends from ViewHandler implementation.

Alexander Smirnov asmirnov at exadel.com
Tue Jan 5 19:56:10 EST 2010


Recently, I've encouraged some fellows to implement JavaFX VDL (
http://alexsmirnov.wordpress.com/tag/javafx/ ), and we got inconsistent
requirements in the spec that makes ViewDeclarationLanguage
implementation close depended from ViewHandler implementation.
Description of the ViewHandler#writeState says:
  public void writeState(FacesContext context) throws IOException;
  Take any appropriate action to either immediately write out the
current view’s state information (by calling
  StateManager.writeState()), or noting where state information may
later be written.
There are no requirements for viewHandler implementation how to write
state late.
On the other hand, default implementation should call
ViewDeclarationLanguage#renderView method that creates appropriate
writer and put actual state. Therefore, it is not possible to introduce
custom ViewDeclarationLanguage without ViewHandler modifications.
Possible solutions are:
1) Introduce ViewDeclarationLanguage#writeState method that should be
called from ViewHandler#writeState in the same way as renderView method
does.
2) Change default ViewHandler#renderView method requirements that it
should create appropriate ResponseWriter before calling
ViewDeclarationLanguage#renderView method, so ViewHandler can perform
late state writing in consistent way.
I prefer to the #2 solution because that allows to reduce duplicated
code in the ViewDeclarationLanguage implementations, but there is a
problem: VDL may provide additional options for response like buffer
sixe, encoding and content type that required to create ResponseWriter.
Possible solution is to make public
ViewDeclarationLanguage#createResponseWriter(FacesContext context)
method that already exists in the Mojarra implementation.




More information about the jsr-314-open-mirror mailing list