use of jakarta.faces.view.ViewDeclarationLanguageFactory in project mojarra by eclipse-ee4j.
the class CompositeComponentTagHandler method applyNextHandler.
// ------------------------------------------- Methods from ComponentHandler
@Override
public void applyNextHandler(FaceletContext ctx, UIComponent c) throws IOException, FacesException, ELException {
// attributes need to be applied before any action is taken on
// nested children handlers or the composite component handlers
// as there may be an expression evaluated at tree creation time
// that needs access to these attributes
setAttributes(ctx, c);
// Allow any nested elements that reside inside the markup element
// for this tag to get applied
super.applyNextHandler(ctx, c);
// Apply the facelet for this composite component
applyCompositeComponent(ctx, c);
// Allow any PDL declared attached objects to be retargeted
if (ComponentHandler.isNew(c)) {
FacesContext context = ctx.getFacesContext();
String viewId = context.getViewRoot().getViewId();
// PENDING(rlubke): performance
ViewDeclarationLanguageFactory factory = (ViewDeclarationLanguageFactory) FactoryFinder.getFactory(FactoryFinder.VIEW_DECLARATION_LANGUAGE_FACTORY);
ViewDeclarationLanguage vdl = factory.getViewDeclarationLanguage(viewId);
vdl.retargetAttachedObjects(context, c, getAttachedObjectHandlers(c, false));
vdl.retargetMethodExpressions(context, c);
getAttachedObjectHandlers(c).clear();
// getAttachedObjectHandlers(c, false).clear();
}
}
use of jakarta.faces.view.ViewDeclarationLanguageFactory in project mojarra by eclipse-ee4j.
the class FaceletViewHandlingStrategy method initialize.
// ------------------------------------------------------- Protected Methods
/**
* Initialize the core Facelets runtime.
*/
protected void initialize() {
LOGGER.fine("Initializing FaceletViewHandlingStrategy");
initializeMappings();
metadataCache = new Cache<>(ccResource -> {
FacesContext context = FacesContext.getCurrentInstance();
return FaceletViewHandlingStrategy.this.createComponentMetadata(context, ccResource);
});
try {
responseBufferSizeSet = webConfig.isSet(FaceletsBufferSize);
responseBufferSize = Integer.parseInt(webConfig.getOptionValue(FaceletsBufferSize));
} catch (NumberFormatException nfe) {
responseBufferSize = Integer.parseInt(FaceletsBufferSize.getDefaultValue());
}
LOGGER.fine("Initialization Successful");
vdlFactory = (ViewDeclarationLanguageFactory) FactoryFinder.getFactory(VIEW_DECLARATION_LANGUAGE_FACTORY);
FacesContext context = FacesContext.getCurrentInstance();
ExternalContext extContext = context.getExternalContext();
Map<String, Object> appMap = extContext.getApplicationMap();
@SuppressWarnings("unchecked") Map<String, List<String>> contractDataStructure = (Map<String, List<String>>) appMap.remove(RESOURCE_LIBRARY_CONTRACT_DATA_STRUCTURE_KEY);
if (!isEmpty(contractDataStructure)) {
contractMappings = new ConcurrentHashMap<>();
for (Map.Entry<String, List<String>> cur : contractDataStructure.entrySet()) {
contractMappings.put(cur.getKey(), new CopyOnWriteArrayList<>(cur.getValue()));
cur.getValue().clear();
}
contractDataStructure.clear();
}
}
use of jakarta.faces.view.ViewDeclarationLanguageFactory in project myfaces by apache.
the class AbstractMyFacesFaceletsTestCase method setUpVDL.
protected void setUpVDL() {
ViewDeclarationLanguageFactory vdlFactory = (ViewDeclarationLanguageFactory) FactoryFinder.getFactory(FactoryFinder.VIEW_DECLARATION_LANGUAGE_FACTORY);
vdl = (MockMyFacesFaceletViewDeclarationLanguage) vdlFactory.getViewDeclarationLanguage("/a.xhtml");
}
Aggregations