Hi Aleksei!
> Scripts are currently managed a bit differently, but I think this is
> also gonna change.
No, there is no need to render scripts in the head, so for
StreamingAddResource this will not be changed.

> In my opinion, this is rather a tricky way to shut yourself in the head.
Well, I am still alive (without hole in my head ... but hey .... whats
happening .... its getting darke.......r..... ) ;-)

The main goal StreamingAddResource tried to address was, to avoid any
additional buffering which will delay the delivery of the page. Since
there are different needs from different users this is why you can
replace the implementation as you would like to.

> Why not simply pre-render body in a buffer (gathering the
> styles/scripts for the header or whatever), and then happily render
> the head with all the gathered resources? A combination of
> document/head/body components could easily do it. You only need a some
> tens of kbs buffer to pre-render the body...
I am not sure, if it is really possible to do this.
Say:
<t:document>
<t:documentHead>
</t:documentHead>
<t:documentBody>
</t:documentBody>
</t:document>

JSF will sequentially render the tags, means, you cant "buffer the body
and then happily render the head" the head has already been rendered
before the body.

You have to buffer in t:document, data will be gathered within
t:documentBody, but you have to add stylesheets and script in
t:documentHead.
This means, you again have to parse the buffer gathered in t:document
and find the <head> stuff.
This solution is nothing better than the DefaultAddResource which will
parse the buffer the same way, or do you have another idea?

Sure, you can buffer the head AND the body, but this will just reduce
the amout of bytes to parse.
What you also can try to do is to discard the first rendering of
documentHead, means:
1) Render Document
2) Render Head (discard output)
3) Render Body in buffer
4) Render Head (not with output)
5) Send body buffer

But see, it will be tricky again, no? ;-) And nobody guarantees you that
all tags within renderHead are able to handle this kind of "double
invocation", though, this shouldn't really be a problem.


As far as I know, weblet only handles the delivery of resources, not the
way how and where to place the link within the page, so in the end, its
not much of help, no?

Ciao,
Mario

Reply via email to