Hi Leo,
Thanks!
Some comments to your ideas:
> - Resource caching (just like myfaces core does!).
This is already implemented and it actually goes one step further,
because it uses GZIP compression too!
> - Find a better name for advanced-resources.xml. It is ok, but I'll
> prefer a more intuitive name, like myfaces-resources-config.xml or
> something like that, so people can understand easily which one is the
> intention of this config file. Maybe some renaming of the classes
> could be helpful (if we find a better name).
That would be very good, yes. Unfortunately I am not good with names..
However, I was thinking of using <faces-config-extension> rather then
a separate xml file for it. WDYT?
> - Make it work with suffix mapping.
This was never the plan of this resource-handler, because it breaks
the ability of having relative-resources (CSS files referencing image
without using #{resource['']}). Thus this should not be implemented
--> specific libraries require specific configurations and as it
happens this resource-handler needs prefix mapping to be configured.
However, you can still use suffix mapping for your xhtml views (prefix
mapping will only be used for the resources in this case).
The other stuff...
> - Relocate resources and replace library names. For example, if my
> custom component uses prototype library and I have to use other jsf
> component library that loads prototype.js with its custom library
> name, allow the custom one uses the file from the jsf library, or
> viceversa.
> - Use content delivery network (CDN) to load known javascript or other
> resource files like jQuery or prototype.
> - Add a SPI interface to delegate .xml resource scanning.
...looks very promising!
Regards,
Jakob
2011/5/17 Leonardo Uribe <[email protected]>:
> Hi
>
> This stuff looks very promising. I think we can additionally implement
> the following ideas:
>
> - Relocate resources and replace library names. For example, if my
> custom component uses prototype library and I have to use other jsf
> component library that loads prototype.js with its custom library
> name, allow the custom one uses the file from the jsf library, or
> viceversa.
> - Use content delivery network (CDN) to load known javascript or other
> resource files like jQuery or prototype.
> - Add a SPI interface to delegate .xml resource scanning.
> - Resource caching (just like myfaces core does!).
> - Find a better name for advanced-resources.xml. It is ok, but I'll
> prefer a more intuitive name, like myfaces-resources-config.xml or
> something like that, so people can understand easily which one is the
> intention of this config file. Maybe some renaming of the classes
> could be helpful (if we find a better name).
> - Make it work with suffix mapping.
>
> That is not very hard to do, but it is a valuable contribution to do.
> Suggestions are welcome.
>
> regards,
>
> Leonardo Uribe
>
> 2011/3/8 Jakob Korherr <[email protected]>:
>> Hi,
>>
>> I just committed the code, see r1079447.
>>
>> In addition, I created the following issue for reference in the jira:
>> MFCOMMONS-29.
>>
>> Feel free to look at it, use it, change it,... - input is always welcome :)
>>
>> Regards,
>> Jakob
>>
>> 2011/2/23 Jakob Korherr <[email protected]>:
>>> Hi guys,
>>>
>>> I developed a custom JSF 2 ResourceHandler for one of my current
>>> projects and I want to "donate" it to MyFaces commons (JSF 2 branch).
>>>
>>> The features of this ResourceHandler include the following:
>>> - relative paths between resources (css files referencing images
>>> without using #resource['..'])
>>> - caching resources in the client (disabled if ProjectStage == Development)
>>> - GZIP compression and local cache in tmp dir (disabled if
>>> ProjectStage == Development)
>>> - i18n (supporting country code and language).
>>>
>>> In addition, it does NOT support ValueExpressions in resource files
>>> for performance reasons.
>>>
>>> The most important feature, in my opinion, is how the resource URL is
>>> built, e.g.
>>> /faces/javax.faces.resource/de_AT/$/some/library/$/my/resource.css
>>>
>>> ... because it permits resources referencing other resources without
>>> #{resource['...']} (e.g. css files referencing images or other css
>>> files). With the standard ResourceHandler this is 1) annoying if you
>>> have to change the files you get from your designer and 2) a
>>> performance bottleneck, because resources with ValueExpressions are
>>> not cached and also regenerated for each request.
>>>
>>> Furthermore, the resource URL contains the locale and thus you have no
>>> problems with cached resources if a users changes the locale, because
>>> he/she will get a new URL and thus a new resource (the right one).
>>>
>>> I'd like to commit the code as a new module on the JSF 2 branch of
>>> MyFaces commons. Are there any objections?
>>>
>>> Regards,
>>> Jakob
>>>
>>> --
>>> Jakob Korherr
>>>
>>> blog: http://www.jakobk.com
>>> twitter: http://twitter.com/jakobkorherr
>>> work: http://www.irian.at
>>>
>>
>>
>>
>> --
>> Jakob Korherr
>>
>> blog: http://www.jakobk.com
>> twitter: http://twitter.com/jakobkorherr
>> work: http://www.irian.at
>>
>
--
Jakob Korherr
blog: http://www.jakobk.com
twitter: http://twitter.com/jakobkorherr
work: http://www.irian.at