Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0, 2.1
    • Fix Version/s: 2.2 Sprint 11
    • Component/s: Lifecycle
    • Labels:
      None

      Description

      Unless Java reflection is used, it is not possible for a portlet bridge to use the JSF 2.0/2.1 API to wrap the Flash implementation provided by Mojarra or MyFaces.

      In order to solve this problem, this issue serves as a proposal to add javax.faces.context.FlashWrapper and javax.faces.context.FlashFactory to the JSF API.

      Background:

      The JSF 2.0/2.1 API does not currently provide a factory-style way of obtaining Flash scope instances. Instead, the ExternalContext#getFlash() method inside the JSF runtime is responsible for acting as
      a pseudo-factory for creating instances.

      One solution for a portlet bridge would be to create its own implementation of the Flash interface. However it is much more desirable to simply wrap the Mojarra/MyFaces flash implementation and override methods where necessary.

      1) Add a FlashWrapper class:

      package javax.faces.context;
      public abstract class FlashWrapper extends Flash implements FacesWrapper<Flash>

      Precedent/Example:
      http://javaserverfaces.java.net/nonav/docs/2.0/javadocs/javax/faces/application/ApplicationWrapper.html

      2) Also to add a FlashFactory:

      package javax.faces.context;
      public abstract class FlashFactory
      extends Object implements FacesWrapper<FlashFactory>
      public abstract Flash getFlash();

      The wrappable FlashFactory instance would take a one-arg constructor and look something like this:

      public class FlashFactoryImpl extends FlashFactory {

      private FlashFactory wrappedFactory;

      public FlashFactoryImpl(FlashFactory flashFactory)

      { wrappedFactory = flashFactory; }

      @Override
      public Flash getFlash()

      { return new FlashImpl(wrappedFactory.getFlash()); }

      @Override
      public FlashFactory getWrapped()

      { return wrappedFactory; }

      }

      Precedent/Example:
      http://javaserverfaces.java.net/nonav/docs/2.0/javadocs/javax/faces/application/ApplicationFactory.html

      3) Add constant FLASH_FACTORY to FactoryFinder and require JSF implementations to return a wrappable FlashFactory instance.

      http://javaserverfaces.java.net/nonav/docs/2.0/javadocs/javax/faces/FactoryFinder.html

        Issue Links

          Activity

          Hide
          Ed Burns added a comment -

          svncom
          Sending jsf-ri/src/main/java/com/sun/faces/config/processor/FactoryConfigProcessor.java
          Transmitting file data .
          Committed revision 9735.

          Show
          Ed Burns added a comment - svncom Sending jsf-ri/src/main/java/com/sun/faces/config/processor/FactoryConfigProcessor.java Transmitting file data . Committed revision 9735.
          Hide
          Ed Burns added a comment -

          Re-open at Neil's request to add wrapper.

          Show
          Ed Burns added a comment - Re-open at Neil's request to add wrapper.
          Hide
          Ed Burns added a comment -

          >>>>> On Sat, 24 Nov 2012 15:11:44 -0500, Neil Griffin said:

          NG> Regarding JAVASERVERFACES_SPEC_PUBLIC-1071 [1], the signature for
          NG> the FlashFactory.getFlash [2] method currently looks like this:

          NG> public abstract Flash getFlash(ExternalContext context, boolean create);

          NG> But I think that the signature should look like the following:

          NG> public abstract Flash getFlash(boolean create);

          NG> The ExternalContext parameter is used by Mojarra as an internal
          NG> implementation detail, and should not be passed as a
          NG> parameter. Instead, the Mojarra FlashImpl constructor should call
          NG> FacesContext.getCurrentInstance().getExternalContext().

          Show
          Ed Burns added a comment - >>>>> On Sat, 24 Nov 2012 15:11:44 -0500, Neil Griffin said: NG> Regarding JAVASERVERFACES_SPEC_PUBLIC-1071 [1] , the signature for NG> the FlashFactory.getFlash [2] method currently looks like this: NG> public abstract Flash getFlash(ExternalContext context, boolean create); NG> But I think that the signature should look like the following: NG> public abstract Flash getFlash(boolean create); NG> The ExternalContext parameter is used by Mojarra as an internal NG> implementation detail, and should not be passed as a NG> parameter. Instead, the Mojarra FlashImpl constructor should call NG> FacesContext.getCurrentInstance().getExternalContext().
          Show
          Ed Burns added a comment - Mark closed when < http://hudson-sca.us.oracle.com/view/MOJARRA_ALL/job/MOJARRA_TRUNK_GLASSFISH_3_1_2_2_NO_CLUSTER/61/ > and < http://tim-vm9.us.oracle.com:7070/hudson/view/Mojarra%20Trunk/job/trunk-test-glassfish-3_1_2_2/184/ > are clean.
          Hide
          Manfred Riem added a comment -

          Closing resolved issue out

          Show
          Manfred Riem added a comment - Closing resolved issue out

            People

            • Assignee:
              Ed Burns
              Reporter:
              Neil Griffin
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 20 minutes
                1h 20m