Issue Details (XML | Word | Printable)

Key: JAVASERVERFACES_SPEC_PUBLIC-1071
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Ed Burns
Reporter: Neil Griffin
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
javaserverfaces-spec-public

Portlet bridge unable to wrap Flash implementation

Created: 14/Feb/12 04:02 PM   Updated: 28/Feb/12 08:28 PM   Resolved: 28/Feb/12 08:28 PM
Component/s: None
Affects Version/s: 2.0, 2.1
Fix Version/s: 2.2 Sprint 11

Time Tracking:
Original Estimate: Not Specified
Remaining Estimate: 0 minutes
Remaining Estimate - 0 minutes
Time Spent: 1 hour
Time Spent - 1 hour

File Attachments: 1. Text File 20120214-1203-i_spec_1071_snapshot-javadoc.patch (31 kB) 14/Feb/12 08:20 PM - Neil Griffin
2. Text File 20120214-1203-i_spec_1071_snapshot.patch (25 kB) 14/Feb/12 05:06 PM - Ed Burns

Issue Links:
Related
 

Tags:
Participants: Ed Burns and Neil Griffin


 Description  « Hide

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



Ed Burns added a comment - 14/Feb/12 05:06 PM

Neil, I'll meet you half way. Here's the first part of the work already done.

I need you to fill out the API javadoc for the two new classes in jsf-api. The real kicker is my insistence on the color coded changebars.

I'm about to write a FAQ entry on how to do those. When I have done so, I'll point to it from this issue.


Neil Griffin added a comment - 14/Feb/12 05:17 PM

Thanks so much for this – I'd be happy to fill out the API JavaDoc.


Ed Burns added a comment - 14/Feb/12 05:22 PM

As promised, here's the FAQ entry.

https://wikis.oracle.com/display/GlassFish/JavaServerFacesRI#JavaServerFacesRI-HowdoImakesurethatchangestothespechavethecorrectversionchangebarattributions%3F

Neil, please download, apply, edit (following the recommendations of the FAQ entry), re-diff, and attach a new patch.

Let me know when you've done it and I'll go to the next base.


Neil Griffin added a comment - 14/Feb/12 08:20 PM

JavaDoc changes incorporated into original patch


Ed Burns added a comment - 15/Feb/12 02:09 AM

Looks great! I'll take it to the next base. I'll be rounding third toward home tomorrow.


Ed Burns added a comment - 15/Feb/12 07:20 PM

svncom
Sending jsf-api/doc/web-facesconfig_2_2.xsd
Sending jsf-api/src/main/java/javax/faces/FactoryFinder.java
Adding jsf-api/src/main/java/javax/faces/context/FlashFactory.java
Adding jsf-api/src/main/java/javax/faces/context/FlashWrapper.java
Sending jsf-api/src/main/resources/overview.html
Sending jsf-ri/resources/jsf-ri-config.xml
Sending jsf-ri/src/main/java/com/sun/faces/config/processor/FactoryConfigProcessor.java
Sending jsf-ri/src/main/java/com/sun/faces/context/ExternalContextImpl.java
Sending jsf-ri/src/main/java/com/sun/faces/context/FacesContextFactoryImpl.java
Sending jsf-ri/src/main/java/com/sun/faces/context/flash/ELFlash.java
Sending jsf-ri/src/main/java/com/sun/faces/context/flash/FlashELResolver.java
Adding jsf-ri/src/main/java/com/sun/faces/context/flash/FlashFactoryImpl.java
Adding jsf-test/JAVASERVERFACES_SPEC_PUBLIC-1071
Adding jsf-test/JAVASERVERFACES_SPEC_PUBLIC-1071/build.xml
Adding jsf-test/JAVASERVERFACES_SPEC_PUBLIC-1071/i_spec_1071_war
Adding jsf-test/JAVASERVERFACES_SPEC_PUBLIC-1071/i_spec_1071_war/pom.xml
Adding jsf-test/JAVASERVERFACES_SPEC_PUBLIC-1071/i_spec_1071_war/src
Adding jsf-test/JAVASERVERFACES_SPEC_PUBLIC-1071/i_spec_1071_war/src/main
Adding jsf-test/JAVASERVERFACES_SPEC_PUBLIC-1071/i_spec_1071_war/src/main/java
Adding jsf-test/JAVASERVERFACES_SPEC_PUBLIC-1071/i_spec_1071_war/src/main/java/com
Adding jsf-test/JAVASERVERFACES_SPEC_PUBLIC-1071/i_spec_1071_war/src/main/java/com/sun
Adding jsf-test/JAVASERVERFACES_SPEC_PUBLIC-1071/i_spec_1071_war/src/main/java/com/sun/faces
Adding jsf-test/JAVASERVERFACES_SPEC_PUBLIC-1071/i_spec_1071_war/src/main/java/com/sun/faces/test
Adding jsf-test/JAVASERVERFACES_SPEC_PUBLIC-1071/i_spec_1071_war/src/main/java/com/sun/faces/test/i_spec_1071_war
Adding jsf-test/JAVASERVERFACES_SPEC_PUBLIC-1071/i_spec_1071_war/src/main/java/com/sun/faces/test/i_spec_1071_war/EchoFlash.java
Adding jsf-test/JAVASERVERFACES_SPEC_PUBLIC-1071/i_spec_1071_war/src/main/java/com/sun/faces/test/i_spec_1071_war/MyFlashFactory.java
Adding jsf-test/JAVASERVERFACES_SPEC_PUBLIC-1071/i_spec_1071_war/src/main/java/com/sun/faces/test/i_spec_1071_war/MyFlashImpl.java
Adding jsf-test/JAVASERVERFACES_SPEC_PUBLIC-1071/i_spec_1071_war/src/main/resources
Adding jsf-test/JAVASERVERFACES_SPEC_PUBLIC-1071/i_spec_1071_war/src/main/webapp
Adding jsf-test/JAVASERVERFACES_SPEC_PUBLIC-1071/i_spec_1071_war/src/main/webapp/WEB-INF
Adding jsf-test/JAVASERVERFACES_SPEC_PUBLIC-1071/i_spec_1071_war/src/main/webapp/WEB-INF/beans.xml
Adding jsf-test/JAVASERVERFACES_SPEC_PUBLIC-1071/i_spec_1071_war/src/main/webapp/WEB-INF/faces-config.xml
Adding jsf-test/JAVASERVERFACES_SPEC_PUBLIC-1071/i_spec_1071_war/src/main/webapp/WEB-INF/web.xml
Adding jsf-test/JAVASERVERFACES_SPEC_PUBLIC-1071/i_spec_1071_war/src/main/webapp/i_spec_1071_war.xhtml
Sending jsf-test/build.xml
Transmitting file data ......................
Committed revision 9683.


Neil Griffin added a comment - 15/Feb/12 07:27 PM

Thanks Ed!!!


Ed Burns added a comment - 28/Feb/12 08:11 PM

Thank goodness for thorough tests.

One testcase that only failed in virtual server mode started failing after this commit and it found this problem:

FactoryConfigProcessor#
private static final String[] FACTORY_NAMES = {

doesn't have FlashFactory.


Ed Burns added a comment - 28/Feb/12 08:28 PM

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