Table of Contents Previous Section Sharing Resources

Sharing Resources

When you add a resource such as an image file to a component, the default behavior is to copy the file into the component's directory. The HTML that WebObjects Builder generates refers to the copy inside the component directory.

You may have resources that you want to share among several applications and several components. To set this up:

  1. Create a directory under your HTTP server's document root.

  2. Specify that directory's name in WebObjects Builder's Preferences panel.

WebObjects Builder already assumes that you have two directories under the document root: Images and Resources. If they don't already exist, create these two directories. Use Images to store image files (.gif, .jpeg, .tiff, and so on). Use Resources to store all other files. You only need to add other directory names to the Preferences panel if you want to further organize your resources. For example, you might want to store all of the sound files in a separate directory named Sounds. In this case, you would create the Sounds directory and then add it to the table in the Preferences panel.

If you drag a resource from one of the directories specified on the Preferences panel, WebObjects Builder assumes you want to share the resource and does not copy it into the component. If the Preferences panel lists extensions next to the directory, it only shares files with that extension.

For example, if you drag a .gif file from the directory <DocumentRoot>/Images to a component, that file is not copied into the component directory because the Preferences panel specifies that all .gif files in <DocumentRoot>/Images are shared resources. However, if there was a sound file in <DocumentRoot>/Images and you dragged it to a component, the sound file would be copied into the component because the Preferences panel does not say that sound files in <DocumentRoot>/Images are shared resources.

If you don't specify file extensions next to the directory name on the Preferences panel, any file in that directory is shared. For example, all files in the Resources directory are shared, regardless of their type.

Note: All of an application's components must reside in the application's directory. You cannot create a shared component directory under the document root. See "Adding Existing Components" to learn how to share components.