You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "Gerhard Petracek (JIRA)" <ji...@apache.org> on 2014/04/18 14:08:15 UTC

[jira] [Updated] (DELTASPIKE-576) improved integration with view-controller

     [ https://issues.apache.org/jira/browse/DELTASPIKE-576?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gerhard Petracek updated DELTASPIKE-576:
----------------------------------------

    Description: 
currently there is no proper handling of exceptions in @PreRenderView callbacks

with that it's e.g. possible to use:
{code}
@ExceptionHandler
public class ErrorViewAwareExceptionHandler {
    @Inject
    private ViewConfigResolver viewConfigResolver;

    public void onIllegalStateException(@Handles ExceptionEvent<IllegalStateException> e)
    {
        FacesContext facesContext = FacesContext.getCurrentInstance();

        String viewId = viewConfigResolver.getDefaultErrorViewConfigDescriptor().getViewId();
        UIViewRoot viewRoot = facesContext.getApplication().getViewHandler().createView(facesContext, viewId);
        facesContext.setViewRoot(viewRoot);
        //... - e.g.: store the exception in a page-bean for the default-error-view
    }
}
{code}

later on we could support it out-of-the-box - e.g. via something like:
{code}
    @ErrorView(forException = {IllegalStateException.class})
    class Error extends DefaultErrorView {}
{code}

> improved integration with view-controller
> -----------------------------------------
>
>                 Key: DELTASPIKE-576
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-576
>             Project: DeltaSpike
>          Issue Type: Improvement
>          Components: JSF-Module
>    Affects Versions: 0.6
>            Reporter: Gerhard Petracek
>            Assignee: Gerhard Petracek
>             Fix For: 0.7
>
>
> currently there is no proper handling of exceptions in @PreRenderView callbacks
> with that it's e.g. possible to use:
> {code}
> @ExceptionHandler
> public class ErrorViewAwareExceptionHandler {
>     @Inject
>     private ViewConfigResolver viewConfigResolver;
>     public void onIllegalStateException(@Handles ExceptionEvent<IllegalStateException> e)
>     {
>         FacesContext facesContext = FacesContext.getCurrentInstance();
>         String viewId = viewConfigResolver.getDefaultErrorViewConfigDescriptor().getViewId();
>         UIViewRoot viewRoot = facesContext.getApplication().getViewHandler().createView(facesContext, viewId);
>         facesContext.setViewRoot(viewRoot);
>         //... - e.g.: store the exception in a page-bean for the default-error-view
>     }
> }
> {code}
> later on we could support it out-of-the-box - e.g. via something like:
> {code}
>     @ErrorView(forException = {IllegalStateException.class})
>     class Error extends DefaultErrorView {}
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)