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

[jsr372-experts] Re: Set and check component resource rendered via standard API

From: Bauke Scholtz <balusc_at_gmail.com>
Date: Thu, 3 Sep 2015 23:08:37 +0200

I created https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1404 on
this.

Cheers, B

On Wed, Mar 4, 2015 at 6:11 PM, Bauke Scholtz <balusc_at_gmail.com> wrote:

> By just adding it to the set.
>
> Cheers, B
>
> On 16:25, Wed, Mar 4, 2015 arjan tijms <arjan.tijms_at_gmail.com> wrote:
>
>> Hi,
>>
>> Sounds good, but one question:
>>
>> If the proposed API just returns a Set<String> where presence of a
>> resource identifier means that resource has been rendered, how does
>> the library indicate it wants to suppress rendering of a certain
>> resource?
>>
>> Kind regards,
>> Arjan
>>
>>
>>
>>
>> On Wed, Mar 4, 2015 at 4:09 PM, Bauke Scholtz <balusc_at_gmail.com> wrote:
>> > In hindsight, that boolean is superfluous. Make it a mutable
>> > Set<ResourceIdentifier> or Set<String> and just consider the presence
>> in the
>> > set as already rendered.
>> >
>> > Cheers, B
>> >
>> > On Wed, Mar 4, 2015 at 4:05 PM, Bauke Scholtz <balusc_at_gmail.com> wrote:
>> >>
>> >> Hi,
>> >>
>> >> Both Mojarra and MyFaces have an internal way to mark a script or
>> >> stylesheet resource as rendered (to avoid duplicate rendering).
>> Mojarra sets
>> >> it as a context attribute with name+library as key and a boolean true
>> as
>> >> value (see a.o. StylesheetRenderer#encodeEnd()). MyFaces sets it as a
>> >> context attribute via a Map<String, Boolean> (see a.o.
>> >> HtmlStylesheetRenderer#encodeEnd() via a ResourceUtils helper class).
>> >>
>> >> For component library developers it would be very useful if this
>> >> information is available by standard API means so that the component
>> library
>> >> can if necessary check and/or suppress the rendering of those
>> resources. For
>> >> example to combine those resources via a special resource handler, or
>> to
>> >> automatically delegate to a CDN host, or to turn a script resource
>> into a
>> >> deferred script, etcetera.
>> >>
>> >> I'd propose adding UIViewRoot#getRenderedComponentResources() which
>> >> returns a mutable Map<ResourceIdentifier, Boolean> for the purpose
>> where
>> >> ResourceIdentifier could also be a String in the standard format
>> >> library+":"+name.
>> >>
>> >> What do others think about it?
>> >>
>> >> Cheers, B
>> >
>> >
>>
>