Using Project WONDER is surprisingly easy. There are only a few steps to get up-and-running:
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:
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.
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."
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:
ERXMessageEncoding.setDefaultEncodingForAllLanguages("UTF-8");
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)
# turn off annoying INFO logs log4j.logger.er=INFO log4j.logger.er.extensions.ERXExtensions=OFF # Enable delegate to emit SQL debugging info. The Logger used is log4j.category.er.extensions.ERXAdaptorChannelDelegate.sqlLogging=DEBUG # put this to true if you want to log sql stuff er.extensions.ERXAdaptorChannelDelegate.enabled=true # How long a statement must run to cause a log message. Messages with longer than # error also emit a stack-trace er.extensions.ERXAdaptorChannelDelegate.trace.milliSeconds.debug=0 er.extensions.ERXAdaptorChannelDelegate.trace.milliSeconds.info=50 er.extensions.ERXAdaptorChannelDelegate.trace.milliSeconds.warn=1000 er.extensions.ERXAdaptorChannelDelegate.trace.milliSeconds.error=5000 # MaxLength of the message er.extensions.ERXAdaptorChannelDelegate.trace.maxLength = 30000 # What entities to watch er.extensions.ERXAdaptorChannelDelegate.trace.entityMatchPattern = .* |
Project WONDER offers a few techniques to deal with backtracking.
My recommended way is to add a method to your WOComponent:
/** * Determine whether the user backtracked. * @return true or false indicating whether the user backtracked */ public boolean didBacktrack() { return ((Session)session()).didBacktrack(); } |
Then anywhere a form is submitted where backtracking might be a problem, add this code to the action method:
if (this.didBacktrack()) { ec.revert(); // handle and prepare to report errors // this.errors.addObject("Unable to process page after back button was pressed."); return this.context().page(); } |
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.
If you want to create the javadoc and you haven't got Eclipse going yet:
cd Wonder/Build/build ant -f build-doc.xml |
open ../../../dist/wonder-4.0/Documentation/api/index.html |
Someone else will have to fill in this section...
ERXWORepetition |