On Apr 8, 2009, at 10:06 PM, Greg Hulands wrote:


On Apr 8, 2009, at 9:38 PM, Chuck Hill wrote:

OK, first off ERXJavaScript is not Ajax technology so you want to avoid it when doing whizzy Web 2.0 stuff. They really don't play all that nicely together.

You can inherit from AjaxComponent and implement addRequiredWebResources something like this:

        protected void addRequiredWebResources(WOResponse response) {
ERXResponseRewriter.addScriptResourceInHead(response, context(), "Ajax", "prototype.js"); ERXResponseRewriter.addStylesheetResourceInHead(response, context(), "Ajax", "calendar.css"); ERXResponseRewriter.addScriptResourceInHead(response, context(), "Ajax", "calendar.js"); ERXResponseRewriter.addScriptResourceInHead(response, context(), "Ajax", "date.js");
        }

Or try putting similar code in appendToResponse.  Does that work?



Ok, putting it in appendToResponse and not subclassing AjaxComponent didn't work, so I now am subclassing it and it is loading the js files.

BUT.....

There is almost always a but when integrating other Ajax stuff into Wonder.


Because the js libraries I'm using are in turn loading other js files that are in their library with relative paths, it is causing a url like this to be generated:

http://localhost:21666/cgi-bin/WebObjects/Pulse.woa/wo/undefined../bespin/editor/component.js

which causes a js error:

failed loading undefined../bespin/editor/component.js with error: SyntaxError: Parse error


It looks as though this is something that dojo does. How does the ajax framework handle interdependent js files from libraries or are they uses the minified ones?

A couple of things:
1. Relative urls are very unlikey to be your friend if you are expecting WO to manage the resources 2. The "undefined" in the URL above looks like something in JavaScript is undefined. Perhaps the root path to the original js file? Fixing that might fix your problem

I'd work on the undefined first. If that gets fixed it will either work or give a different problematic URL. What do to next? DirectConnect (localhost:21666) is also unlikely to be your friend here. You could go through a web server and just give up on the idea of having these taken from your project resources at development time. Make a softlink from the web server's doc root to where the JavaScript is and use result <script> tags to load them with URLs starting with /. Wonder also has some very nice resource handling built into its resource manager. I don't know much about it, but it is intended to help with things like this. Relatives paths might not be handled, I am not sure.

Mike did the work on getting prototypes, scriptaculous etc working so maybe he has some good ideas here.

Chuck


I tried doing it before calling super, but it complained that the session had died.

That seems... odd.


This was the response

<html>
<head><title>Missing Session Error</title></head>
<body>
<hr>
<strong>
Your session has timed out.</strong>
<hr>
</body>
</html>





--
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects






_______________________________________________
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