Bundling Files Optimizing the Use of Published Files

Changing the Look and Navigation of the Oracle Content Server Interface 4-5 3. Merge a table with the PublishStaticFiles table in std_resources.htm. This lists the directories that contain files, such as images, that should be published to the weblayout directory.

4.1.3 Optimizing the Use of Published Files

You can direct Oracle Content Server to bundle published files so they can be delivered as one, thus minimizing the number of page requests to the server. In addition, you can optimize file use by referencing published pages using Idoc Script. The following sections describe how to optimize the use of published files: ■ Section 4.1.3.1, Bundling Files ■ Section 4.1.3.2, Referencing Published Files

4.1.3.1 Bundling Files

Multiple resources may be packaged together into units called bundles. A bundle is a single file containing one or more published resources. Only JavaScript and css resources should be bundled and only with other resources of the same type. Bundling helps reduce the client overhead when pages are loaded but increases client parsecompileexecute overhead. Generally, it is recommended to bundle resources that have some thematic similarity or are expected to be included at similar times. For example, if you know that resources A, B, and C are needed on every page, and resources D, E, and F are needed rarely but are all needed together, it is recommended to bundle A, B, and C together and to put D, E, and F into a separate bundle. Almost all core Oracle Content Server JavaScript resources are bundled into one of two bundles: yuiBundle.js, which contains script provided by the third-party Yahoo User Interface library, and bundle.js, which contains the rest of the resources. The PublishedBundles table is used for determining how resources are bundled. Essentially a bundle is identified by its target bundlePath, which is the path name to the bundle relative to the weblayout directory, and a list of rules detailing which resource classes are included or excluded. A loadOrder value in this table applies only to the order in which the filtering rules are applied, not the order in which the resources appear in the bundle. Static weblayout file contents are cached on client machines and on web proxies, significantly lowering the amount of server bandwidth they use. Therefore, the best practice is to use these types of files wherever possible. However, each static weblayout file requested by the client’s browser requires a round-trip to the server just to verify that the client has the most up-to-date version of the file. This occurs even if the file is cached. Therefore, as the number of these files grows, so does the number of downloads from the server for each page request. To help minimize the number of round-trips, Oracle Content Server can bundle multiple published files so they are delivered as one. This feature can be disabled by setting the following configuration in the server’s IntradocDirconfigconfig.cfg file: BundlePublishedWeblayoutFiles=false Note: The bundling has changed since Oracle UCM 10g, which used a different table and had a loadOrder value that determined the order of resources in each bundle. 4-6 Oracle Fusion Middleware Developers Guide for Oracle Universal Content Management Bundling is accomplished by using the PublishedBundles table in the std_resources.htm file. table PublishedBundles table border=1captionstrong tr tdbundlePathtd tdincludeClasstd tdexcludeClasstd tdloadOrdertd tr tr tdresourcesbundle.jstd tdjavascript:commontd tdtd td128td tr . . . table end The columns in this table are as follows: ■ bundlePath: The eventual location where the bundle is published. This path is relative to the weblayout directory. ■ includeClass: This is used to determine which resources to include in a bundle. ■ excludeClass: This is used to determine which resources to exclude from a bundle. ■ loadOrder: The order in which the includeClass and excludeClass filters are applied. In the previous example, files of the javascript:common class are published to a single bundle located at resourceslayoutscommonBundle.js. The contents of all bundled files that match this class are appended to form a single file to be stored at that location.

4.1.3.2 Referencing Published Files