Sharing Reusable Components Across Applications
If a component is in the WebObjects application's directory, it can be used over and over again, but only within that application. This may be fine for some components, but others, you'll want the option to reuse in many applications. If a component is packaged in a framework, it can be used in any WebObjects application.To package components in a framework for reuse by several applications, do the following:
- Create a project in Project Builder of type WebObjectsFramework.
- Add to this project (under Web Components) all of the components that you want to share across applications.
- Add any resources needed by the components. If the HTTP server needs access to the resource (which is the case for image files and any file that will ultimately be referenced in the HTML file), add it under WebServerResources. Otherwise, add it under Resources.
- Build the framework. If you perform a make install, it installs the framework in NeXT_ROOT/NextLibrary/Frameworks and the WebServer resources in <DocRoot>/WebObjects/Frameworks.
You must build the framework even if it contains only scripted components.
- In Project Builder, add the framework to the application's project under Frameworks.
- Build the application.
The application's executable file must contain all components that your application references, as described in the next section. For this reason, you must build the application even if it contains only scripted components.
Table of Contents Next Section