Craig McClanahan schrieb:

You don't actually need to code a hard dependency on an implemenation of NavigationHandler. Pretty much all of the JSF extension points support the use of a "decorator pattern" so you can delegate behavior to the standard implementation, without knowing its class name. You'd do something like this:

    public class MyNavigationHandler extends NavigationHandler {

        private NavigationHandler original;

        public MyNavigationHandler(NavigationHandler original) {
            this.original = original;
        }

        public void handleNavigation(...) {

            // Delegate to standard navigation handler
            original.handleNavigation(...);

            // Examine the new viewId to see if its ok
            String newViewId = context.getViewRoot().getViewId();
            if (isAcceptable(newVieId)) {
                return;
            } else {
                ... do something else ...
            }

        }

    }

The key concept is that you provide a constructor that takes an instance of the API you are implementing. As JSF processes configuration files, it will pass in the previously configured version to your constructor.

    Regards
    Ingo


Craig
Oh no, I didn't saw it. I believed that after calling the original navigation handler everything is done and I had no chance to do anything additional.

Amazing thing, it took me about 1 hour to integrate shale into my project and most of the time I needed to figure out how to compile shale sources and how to configure my own pom dependencies :-)

By the way I found an issue in your CommonsValidatorTestCase class. It depends that the local country settings of the operation system. If it is not set to english you got localized error messages and then the equals assertions fail.

Really cool thing ...

Ingo





Reply via email to