New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Portlet bridge unable to wrap Flash implementation #1071
Comments
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented 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. |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented 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. |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented One testcase that only failed in virtual server mode started failing after this commit and it found this problem: FactoryConfigProcessor# doesn't have FlashFactory. |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented
NG> Regarding #1071 [1], the signature for 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 |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
|
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.
package javax.faces.context;
public abstract class FlashWrapper extends Flash implements FacesWrapper
Precedent/Example:
http://javaserverfaces.java.net/nonav/docs/2.0/javadocs/javax/faces/application/ApplicationWrapper.html
package javax.faces.context;
public abstract class FlashFactory
extends Object implements FacesWrapper
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
http://javaserverfaces.java.net/nonav/docs/2.0/javadocs/javax/faces/FactoryFinder.html
Affected Versions
[2.0, 2.1]
The text was updated successfully, but these errors were encountered: