jsr372-experts@javaserverfaces-spec-public.java.net

[jsr372-experts] Re: Resolving "pending" in Mojarra source, mostly wrt contracts?

From: Leonardo Uribe <leonardo.uribe_at_irian.at>
Date: Mon, 2 Feb 2015 22:57:59 -0500

Hi

As far as I can remember there is no issues for contracts / resource
handling in the spec. At least, the implementation available in
MyFaces works just perfect, so the spec is consistent from my point of
view.

The only minor thing that I can remember is FaceletCache uses the url
as key to hold Facelet instances, which is a bit weird for resource
library contracts, because in that case we have a
contractName/libraryName/resourceName. But anyway it works, since once
deployed, the contracts available doesn't really change, even if you
load them from a database. FaceletCache is ok with the url.

Theoretically, you can bundle a composite component inside a resource
library contract. That should work.

regards,

Leonardo

2015-02-02 14:17 GMT-05:00 arjan tijms <arjan.tijms_at_gmail.com>:
> Hi,
>
> While reading up on resource handling in the Mojarra source code, I
> noticed there were quite a few PENDING markers there.
>
> E.g.
>
>
> com.sun.faces.facelets.impl.DefaultFaceletFactory.needsToBeRefreshed(URL)
>
> // PENDING(FCAPUTO) not sure, if this is what we want.
> for (FaceletCache<DefaultFacelet> faceletCache :
> cachePerContract.values()) {
>
>
> com.sun.faces.facelets.impl.DefaultFaceletFactory.getCache(FacesContext)
>
> // PENDING(FCAPUTO) we don't support
> com.sun.faces.config.WebConfiguration.WebContextInitParameter#FaceletCache
> for contracts
> faceletCache = initCache(null);
>
>
> com.sun.faces.facelets.impl.DefaultFaceletFactory.resolveURL(String)
>
> // PENDING(FCAPUTO) Deactivated caching for resource library
> contracts. If we still want to cache it, we need a cache per contract
> libraries list.
> // But the ResourceHandler caches on his own (using
> ResourceManager).
> URL url = this.resolveURL(this.baseUrl, uri);
>
>
> com.sun.faces.facelets.impl.DefaultFaceletFactory._createComponent(FacesContext,
> String, String, Map<String, Object>)
>
> // PENDING(FCAPUTO) does this work for resource library contracts? I think so.
> UIComponent result = null;
> Application app = context.getApplication();
>
>
> com.sun.faces.application.resource.ResourceHandlerImpl.libraryExists(String)
>
> // PENDING(fcaputo) do we need to iterate over the contracts here? I
> don't think so.
> LibraryInfo info = manager.findLibrary(libraryName, null,
> null, context);
>
> com.sun.faces.application.resource.ResourceHelper.getInputStream(ResourceInfo,
> FacesContext)
>
> // PENDING(edburns): this is a sub-optimal implementation choice
> // done in the interest of prototyping. It's never a good idea
> // to do a switch statement based on the type of an object.
>
> InputStream in = null;
>
>
> com.sun.faces.application.resource.ResourceManager.findResource(String)
>
> // PENDING(fcaputo) do we need to handle contracts here?
> String libraryName = null;
> String resourceName = null;
>
>
> I wonder if there should be a kind of theme in JSF 2.3 to resolve
> those pending issues, especially where it concerns the contracts /
> resource handling?
>
> Kind regards,
> Arjan Tijms