Integrate Wonder Into an Existing Application
Version 15.1 by Kieran Kelleher on 2007/10/01 22:02
Introduction
So you have decided to take the plunge and take advantage of the many useful features of Project Wonder. The most common usage of Project Wonder is to simply integrate the Wonder foundation frameworks of ERJars, ERExtensions and JavaWOExtensions into your project. Doing this fixes many problems with the standard WebObjects frameworks and provides easy access to many configurable features that most typical WebObjects applications need.
In this short article, we itemize the absolute minimum to add Wonder to your project and avoid initial integration stumbles.
Minimum Wonder Integration
- Add ERJars, ERExtensions and Wonder's JavaWOExtensions frameworks to your project's framework references
- Remove existing log4j jar if your project had that.
- Make it so your Application class subclasses ERXApplication
- Make it so your Session class subclasses ERXSession
- Make it so your DirectAction classes extend ERXDirectAction
- Your Application class' main static method {+}must{+} call ERXApplication.main(...) instead of WOApplication.main(...). Your application will fail to initialize and launch otherwise.
- Use ERXEC.newEditingContext() to create new editing contexts in your application
- Add minimal content to Properties file. To get minimal content, create a temporary empty project using the WOnderApplication WOLips project template and copy/paste the contents from that template's Properties file.
Application main method
public static void main(String argv[]) {
ERXApplication.main(argv, Application.class);
}
Easy Extras
If you got the minimum Wonder integration done and your app is working, then adding these extra fundamental useful frameworks are definitely worthwhile from the start:
- ERPrototypes - save yourself lots of manhours fiddling with EOModel attributes by using convenient prototypes. This is considered best practice.
- ERJavaMail - send all kinds of emails - plain text, html, multi-part, attachments, etc. HTML can be generated from a WOComponent or be set using a HTML String.
- ERSelenium - functional testing that simulates user interaction with your app's web pages.