Using Project WONDER is surprisingly easy. There are only a few steps to get up-and-running:
- Download and installthe Project WONDER frameworks;
- Add the ERJars.framework and ERExtensions.framework to your WebObjects project;
- Change your Application class to extend er.extensions.ERXApplication instead of WOApplication;
- Change your Application.main method to call er.extensions.ERXApplication.main instead of WOApplication.main;
- Change your Session class to extend er.extensions.ERXSession instead of WOSession;
- Change your DirectAction class to extend er.extensions.ERXDirectAction instead of WODirectAction;
When using Xcode out of the box, there will be an error upon launching this application (as of Feb 6, 2007):
"No ERX_MARKER field in NSMutableArray found."
This means your class path is incorrect. Adjust it so that ERExtensions come before JavaFoundation. To do this, you must change the order of your classpath so that ERExtensions appears above JavaFoundation. In my default classpath, JavaFoundation appears first in the list. If you are using Xcode, follow Jerry Walker's instructions:
- Select "Application Server" in your Active Target popdown menu at the top left of your Xcode window.
- Type command-option-e or choose the Project->Edit Active Target 'Application Server' menu item. This will open a target editing window.
- Select 'Link Binary With Libraries' under 'Build Phases' in the left-hand view.
- You can edit the framework load order by dragging framework up or down in the list on the right. Drag the ERExtensions.framework to the top.
- Rearrange these frameworks in the editing pane into any order that you desire by dragging and dropping them within the editing pane.
- Set your Active Target popdown menu back to the name of your project. <b>THIS IS IMPORTANT.</b>
- Clean and rebuild your app and your classpath settings should be rearranged accordingly.
This error only occurs with Xcode and, obviously, this workaround applies to Xcode and not Eclipse. Also, there is also an Xcode project template for an ERXApplication available. (from where?)
If you are using WOLips, you can create a new "Project Wonder Application" which will setup a project with these steps already performed.
That's it! You are now using Project WONDER and you've begun your journey to easier WO application development.
Notes from David Teran
From David Teran Dec 1 2004: Pointers for getting your head around the frameworks
"PW consists of different frameworks, the most important one is ERExtensions, then for D2W apps additionally ERDirectToWeb, some if not all people are using ERCoreBusinessLogic. The other frameworks are build on top of one or multiple from these.
BUT: i would start reading the class description and then the javadoc, its generated from the sourcecode with eclipse within a second ( ok, maybe 60... ) and its read in about 1 - 3 hours.
Then i would take a look ERXApplication, ERXSession, ERXGenericRecord, ERXEC (very interesting!), ERXThreadStorage (very interesting, too), ERExtensions, ... and the various utility classes: ERXEOControlUtilities, ERXEOAccessUtilities, ERXArrayUtilities and so on."
Notes from Chris Meyer
Internationalization and Localization
Practical WebObjects outlines one technique for handling internationalization. It is incompatible with Project WONDER.
To handle internationalization in Project WONDER, delete the takeValuesFromRequest from your Session class (which should now be derived from ERXSession). Likewise, delete the createResponseInContext method from your Application class (which should now be derived from ERXApplication). Then add the following call to your Application constructor:
Practical WebObjects outlines one technique for SQL logging. Project WONDER uses an entirely different technique.
In Project WONDER, put this in one of the properties files (I use ~/WebObjects.properties)
Project WONDER offers a few techniques to deal with backtracking.
My recommended way is to add a method to your WOComponent:
Then anywhere a form is submitted where backtracking might be a problem, add this code to the action method:
ERXWORepetition also contains some code to deal with backtracking. As of Project WONDER 3.0, the code seems to work inconsistently. When the page is backtracked and the form submitted, values in the form are just passed as null. This tends to cause more problems than it is worth, although your situation may be different. Also, there is an option to throw an exception when the page is backtracked, but this exception doesn't seem to be thrown consistently.
Creating javadocs from the Wonder source (not using Eclipse)
If you want to create the javadoc and you haven't got Eclipse going yet:
- Get the latest source from the nightly build server.
- Once you untar it you'll have a Wonder folder created.
- In the terminal app % cd to the Wonder/Build/build directory
- % ant doc
- Wait several minutes while some good stuff scrolls by in your terminal window (If ant gives you errors, you may have to set it to use ant 1.4 instead of 1.5 by exporting: JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.4/Home)
- Find the new dist/wonder-2.0/Documentation/api/index.html page that has been created in the same directory as the Wonder folder was untarred in
- Double click on the index.html page and the javadocs will open in your favourite browser
Creating javadocs from the Wonder source (using Eclipse)
Someone else will have to fill in this section...