Uploaded image for project: 'Seam 2'
  1. Seam 2
  2. JBSEAM-5007

SeamNavigationHandler should extend ConfigurableNavigationHandler instead

    Details

    • Steps to Reproduce:
      Hide

      use primeface and use p:button on a page

      Show
      use primeface and use p:button on a page
    • Affects:
      Compatibility/Configuration
    • Workaround Description:
      Hide

      public class SeamNavigationHandler extends ConfigurableNavigationHandler
      {

      private final NavigationHandler baseNavigationHandler;

      public SeamNavigationHandler(NavigationHandler navigationHandler)

      { this.baseNavigationHandler = navigationHandler; }

      @Override
      public void handleNavigation(FacesContext context, String fromAction, String outcome)
      {
      if ( !context.getResponseComplete() ) //workaround for a bug in MyFaces
      {
      if ( isOutcomeViewId(outcome) )

      { FacesManager.instance().interpolateAndRedirect(outcome); }

      else if ( Init.instance().isJbpmInstalled() && Pageflow.instance().isInProcess() && Pageflow.instance().hasTransition(outcome) )

      { Pageflow.instance().navigate(context, outcome); }

      else if ( !Pages.instance().navigate(context, fromAction, outcome) )

      { baseNavigationHandler.handleNavigation(context, fromAction, outcome); }

      }
      }

      private static boolean isOutcomeViewId(String outcome)

      { return outcome!=null && outcome.startsWith("/"); }

      @Override
      public NavigationCase getNavigationCase(FacesContext context, String fromAction, String outcome) {
      System.out.println(baseNavigationHandler.getClass());
      if (baseNavigationHandler instanceof ConfigurableNavigationHandler)

      { return ((ConfigurableNavigationHandler) baseNavigationHandler).getNavigationCase(context, fromAction, outcome); }

      else

      { return null; }
      }

      @Override
      public Map<String, Set<NavigationCase>> getNavigationCases() {
      if (baseNavigationHandler instanceof ConfigurableNavigationHandler) { return ((ConfigurableNavigationHandler) baseNavigationHandler).getNavigationCases(); } else { return null; }

      }

      }

      Show
      public class SeamNavigationHandler extends ConfigurableNavigationHandler { private final NavigationHandler baseNavigationHandler; public SeamNavigationHandler(NavigationHandler navigationHandler) { this.baseNavigationHandler = navigationHandler; } @Override public void handleNavigation(FacesContext context, String fromAction, String outcome) { if ( !context.getResponseComplete() ) //workaround for a bug in MyFaces { if ( isOutcomeViewId(outcome) ) { FacesManager.instance().interpolateAndRedirect(outcome); } else if ( Init.instance().isJbpmInstalled() && Pageflow.instance().isInProcess() && Pageflow.instance().hasTransition(outcome) ) { Pageflow.instance().navigate(context, outcome); } else if ( !Pages.instance().navigate(context, fromAction, outcome) ) { baseNavigationHandler.handleNavigation(context, fromAction, outcome); } } } private static boolean isOutcomeViewId(String outcome) { return outcome!=null && outcome.startsWith("/"); } @Override public NavigationCase getNavigationCase(FacesContext context, String fromAction, String outcome) { System.out.println(baseNavigationHandler.getClass()); if (baseNavigationHandler instanceof ConfigurableNavigationHandler) { return ((ConfigurableNavigationHandler) baseNavigationHandler).getNavigationCase(context, fromAction, outcome); } else { return null; } } @Override public Map<String, Set<NavigationCase>> getNavigationCases() { if (baseNavigationHandler instanceof ConfigurableNavigationHandler) { return ((ConfigurableNavigationHandler) baseNavigationHandler).getNavigationCases(); } else { return null; } } }

      Description

      Primeface won't work without this fix.

      Get classcast exception

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                manaRH Marek Novotny
                Reporter:
                trind Joachim Andersson
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 1 hour
                  1h
                  Remaining:
                  Remaining Estimate - 1 hour
                  1h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified