myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "todor.dimitrov" <todor.dimit...@me.com>
Subject Re: "ExternalContext#responseSendError" does not interrupt JSF Lifecycle
Date Fri, 25 Jan 2013 11:50:57 GMT
I just found out that the test method of the bean is called during the RENDER_RESPONSE phase.
This of course explains the observed behavior.

Mystery solved :)


On 25.01.2013, at 12:08, "todor.dimitrov" <todor.dimitrov@me.com> wrote:

> Hi,
> 
> I'm using the "ExternalContext#responseSendError" inside a Bean method like this:
> 
> 	public void test() {
> 		// some logic
> 
> 		final FacesContext facesContext = FacesContext.getCurrentInstance();
> 		final ExternalContext externalContext = facesContext
> 				.getExternalContext();
> 		try {
> 			externalContext.responseSendError(HttpServletResponse.SC_NOT_FOUND, null);
> 		} catch (IOException ex) {
> 			throw new RuntimeException(ex);
> 		}
> 		facesContext.responseComplete();
> 	}
> 
> The JSF Lifecycle is not interrupted such that validation and rendering for the current
view are still taking place. Is this the expected behavior? Is there a way to just abandon
processing altogether as soon as "ExternalContext#responseSendError" is called?
> 
> 
> Regards,
> 
> Todor
> 
> 
> 


Mime
View raw message