This issue serves as a task for adding a new chapter titled "Factories" to the Bridge Spec which should document the additions to the API as described in the following issues:
- FACES-2536: BridgeFactoryFinder
- FACES-2595: BridgeConfigFactory
- FACES-2657: BridgeURLFactory
- FACES-2679: BridgePortletRequestFactory / BridgePortletResponseFactory
- FACES-2684: BridgePortletConfigFactory / BridgePortletContextFactory
- FACES-2692: RequestAttributeInspectorFactory
- FACES-2778: BridgeEventHandlerFactory / BridgePublicRenderParameterHandlerFactory
The new chapter must also state that bridge implementations must scan the classpath when a listener receives notification of javax.faces.event.PostConstructApplicationEvent.
Also, the chapter must describe that the javax.portlet.faces.BridgeFactoryFinder may not be called at the time of portlet/bridge initialization, such as when the Bridge.init(PortletConfig) method is called. This is caused by the fact that the Portlet Specification does not require portlet container implementations to ensure that ServletContextListeners (like the Mojarra ConfigureListener) execute before portlets are initialized. While this is indeed the case with Apache Pluto (the reference implementation), it is not the case with Liferay Portal. As a result, the javax.portlet.faces.BridgeFactoryFinder can only be used to find factories during request/response processing. This also has the effect of preventing factories from returning objects that are guaranteed to be stateless, thread-safe singletons unless the factories use a thread-safe double-checked locking pattern to initialize the objects.
The following factories return singletons:
The following factories do not return singletons: