public ScriptsEncoderFactoryAlloyImpl(ScriptsEncoderFactory scriptEncoderFactory) { if (LIFERAY_PORTAL_DETECTED && LIFERAY_FACES_BRIDGE_DETECTED) { this.scriptsEncoder = scriptEncoderFactory.getScriptsEncoder(); } else { this.scriptsEncoder = new ScriptsEncoderAlloyImpl(); } this.wrappedScriptsEncoderFactory = scriptEncoderFactory; }
/** * Returns a stateless, thread-safe singleton instance of {@link ScriptsEncoder} from the {@link * ScriptsEncoderFactory} found by the {@link FactoryExtensionFinder}. ScriptsEncoder is a stateless, thread-safe * (and potentially singleton) because it is designed to be used by a {@link javax.faces.render.Renderer}, which is * stateless and thread-safe singleton. * * @param externalContext The external context associated with the current faces context. It is needed in order * for the {@link FactoryExtensionFinder} to be able to find the factory. * * @since 3.1 * @since 2.1 * @since 1.1 */ public static ScriptsEncoder getScriptsEncoderInstance(ExternalContext externalContext) { ScriptsEncoderFactory scriptsEncoderFactory = (ScriptsEncoderFactory) FactoryExtensionFinder.getFactory( externalContext, ScriptsEncoderFactory.class); return scriptsEncoderFactory.getScriptsEncoder(); }