Hi Aaron,

(sorry, been on holidays and just catching up...)

On 08/01/2008, at 5:52 AM, [EMAIL PROTECTED] wrote:

Hi Lachlan, you have some good ideas.

1) Scan all java WOComponent files at application launch and make a list
of needed resources:
This is cool. The one drawback is that every page you go to would have
lots of JS and CSS files in the head tag, even if there is no possibility
of using a given file on that particular page.

Not quite what I had in mind. I was thinking more along the lines of being able to determine the dependency tree of your components and thus for a particular page you'd be able to look up what possible resources are needed. i.e., so you'd only be including resources that are possible to use for any given page.

It's not so bad though
because those resources between the head tags get cached and will be used sooner or later anyway if the user continues for any meaningful length of
time. I'm not sure how to immediately go about scanning all the java
files, have you implemented anything like that before?

Scanning for *.wo files (in both the app and your frameworks) is much easier. You could then create a dummy WOContext and get the results of pageWithName for each component and perform some function on it (i.e., via an interface of some kind)

I think in the
meantime I'm going to use an approach similar to this but instead of
scanning all the java sources I'm just going to make
"appendResourceInHead()" a static method on all the subComponents and just
manually call all these from the pageWrapper.

2) Augmenting the UserInfo dictionary of WOResponse:
Unfortunately this won't work because not all the needed elements would be
questioned to give their input to the augmented UserInfo dictionary.

3) Dynamically load javascript or modify the DOM:
This probably can work. Mike Schrag has also alluded to this in the past as a possible solution. Ideally you could modify the contents between the "head" tags in the DOM and hopefully most browsers would understand that you inserted a JS or CSS reference and load them on the fly, possibly even utilizing the local browser cache. But this would have to be tested and might not work on a "Opera" for example. Another angle would be to always check for the existence of a function or javascript object before blindly
using it. If it is not defined, then you could make an Ajax call and
download the needed file on the fly, possibly using "evaluate" to load the needed functionality. This would not make use of the cache but would only happen at most once per page. While this is all perhaps possible, it would
take a bit of experimentation and may not be totally cross browser
compatible.

Sure, and this is certainly not an area I can be of much help with.

with regards,
--

Lachlan Deck



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to