myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Koci (JIRA)" <...@myfaces.apache.org>
Subject [jira] Commented: (MYFACES-2544) UIViewRoot skips uncorrectly encodeBegin
Date Wed, 10 Feb 2010 20:38:31 GMT

    [ https://issues.apache.org/jira/browse/MYFACES-2544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12832185#action_12832185
] 

Martin Koci commented on MYFACES-2544:
--------------------------------------

> when there is an error on a beforePhase listener. If there is, context.getResponseComplete()
could return true, inclusive on render response phase. 

How is context.getResponseComplete() related to error handling? I don't get the point about
error in beforePhase - if there is a error in phaseListener it is logged and/or published
with exceptionHandler: "6.2.2 Backwards Compatible ExceptionHandler" and  "12.3 PhaseListener"



> Please note maybe there is a misundersanding about what >FacesContext.renderResponse()
and FacesContext.getRenderResponse() do. > The meaning of this constant is allow jsf to
skip phases when an error > occur. For example, if a validator throws a RuntimeException,
> ProcessUpdates and InvokeApplication phases should not be executed, so they will be skipped
and RenderResponse phase should occur.

Yes, but why exclude from executing exactly one method at particular class? Why UIViewRoot.encodeEnd
is not exluded? UIViewRoot.encodeBegin represents the beginning of render response phase as
component. It is legal for a listener (action or valueChange) to call context FacesContext.renderResponse()
but it does not mean that there was a error - listener can simple be smart enough to know
that no other phases except for render response are needed.

 > Why UIViewRoot.encodeBegin skip render the view? because in jsf 1.2
 > this is considered an error and encodeBegin should not happen,
 > instead, the error page is published. 
I don't think  "FacesContext.getRenderResponse() true = a runtime exception" is a valid expectation
- skipping to render response phase is a possible response to runtime exception, but it does
not imply that render response phase is executing as response to error.

Here is example what should work:
MyUIView extends UIViewRoot {

	encodeBegin() {
	super.encodeBegin()	 
	// super notifies phase listeners, puts component to EL and publish PreRenderComponentEvent
	
	// rendering specific stuff here
}
}

This was not working with mojarra and isn't working with myfaces. But clearly it can be fixed
with adding 

context.getApplication().publishEvent(PreRenderComponentEvent.class) and it will work together
with algorithm requested by spec.

> UIViewRoot skips uncorrectly encodeBegin
> ----------------------------------------
>
>                 Key: MYFACES-2544
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2544
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-2
>         Environment: myfaces trunk
>            Reporter: Martin Koci
>            Assignee: Jakob Korherr
>             Fix For: 2.0.0-beta-2
>
>         Attachments: MYFACES-2544.patch
>
>
> javax.faces.component.UIViewRoot.encodeBegin(FacesContext) contains:
> if (!skipPhase) {
>    super.encodeBegin(context);
> }
> but skipPhase = context.getRenderResponse() || context.getResponseComplete() - it
> makes sense for all phases except render response phase itself. That condition
> probably should be:
> if (!context.getResponseComplete()) {
>             super.encodeBegin(context);
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message