About Fragmentation with the Inline and Include Tags

Caching Dynamic Content with ESI Language Tags 11-17 When assembly of fragments is complete, Oracle Web Cache includes a Set-Cookie response-header field in the response with the cookie information from the template. For those fragments with a Host request-header field that matches the Host request-header field in the template, Oracle Web Cache also accumulates the Set-Cookie response-header fields with that of the template. For those fragments with a Host request-header field that does not match the Host request-header field in the template, Oracle Web Cache does not accumulate the Set-Cookie response-header field with that of the template and other matching fragments. See Section 11.1.6 for a description of how you can use the HTTP_COOKIE variable in ESI markup.

11.2 Enabling Dynamic Assembly of Content and Partial Page Caching

For an overview of partial page caching, see Section 11.1 . This section describes how to enable dynamic assembly of Web pages with fragments and how to create rules for the cacheable and non-cacheable page fragments. It contains the following topics: ■ Section 11.2.1, Enabling Partial Page Caching ■ Section 11.2.2, Using ESI for Simple Personalization ■ Section 11.2.3, Examples of ESI Usage

11.2.1 Enabling Partial Page Caching

To enable partial page caching:

1. Configure the template page as follows:

a. Use ESI markup tags in the template to fetch and include the fragments.

b. In the template page, configure the HTTP response with the

Surrogate-Control response-header field. For example: Surrogate-Control: max-age=30+60, content=ORAESI9.0.4

c. If the Surrogate-Control response-header field does not include all the

caching attributes required for the template page, create a caching rule for the page.

2. Configure the fetchable fragments:

■ Use a Surrogate-Control response-header field in the HTTP response message. ■ If the Surrogate-Control response-header field does not include all the caching attributes required for the fragment, create a caching rule for the fragment. For more information, see: Important: ESI tags cannot be used on a page that contains -- WEBCACHETAG-- and -- WEBCACHEEND-- tags. If you require simple personalization and are using ESI, see Section 11.2.2, Using ESI for Simple Personalization . 11-18 Oracle Fusion Middleware Administrators Guide for Oracle Web Cache ■ Section 11.4 for further information about ESI markup tags ■ Section 6.10 for further information about configuring the Surrogate-Control response-header field ■ Section 6.8 for further information about configuring caching rules

11.2.2 Using ESI for Simple Personalization

You can use variable expressions for simple personalization. For example, the following HTML substitutes a users name based on the value the client browser passes with username cookie. In addition, the session information contained within the sessionID cookie is used to replace session information for one user with another user. The same effect is achieved with the following ESI markup: esi:vars Welcome HTTP_COOKIE{username} Here is a A HREF=jspmyPage.jsp?sessionID=QUERY_ STRING{sessionid}linkA. esi:vars The esi:vars tag enables you to use an ESI environment variable outside of an ESI tag. You can also use variables with other ESI tags. See the following sections: ■ Section 11.1.6, Variable Expressions ■ Section 11.4.9, ESI vars Tag

11.2.3 Examples of ESI Usage

This section provides examples of ESI usage in the following topics: ■ Section 11.2.3.1, Example of a Portal Site Implementation ■ Section 11.2.3.2, Example of Simple Personalization with Variable Expressions

11.2.3.1 Example of a Portal Site Implementation

Figure 11–2 shows a portal site response page, http:www.company.comservletoportal?username=Mark, for a registered user named Mark. Caching Dynamic Content with ESI Language Tags 11-19 Figure 11–2 Portal Site Page This page is assembled by Oracle Web Cache. A template page configured with ESI markup tags for a personalized greeting, weather, stocks, promotional advertisement, news, and sports fragments is assembled based on Marks preferences. For example, because Mark chose San Francisco weather, the application looks up San Francisco weather information and puts it into the final full HTML page output. Because of its dynamic content, this page would not be cacheable. On the other hand, with ESI markup tags, Oracle Web Cache assembles and caches most of the content. The following sections describe how the template page and its fragments are implemented using esi:inline and esi:include tags: ■ Section 11.2.3.1.1, Portal Example Using inline Tags ■ Section 11.2.3.1.2, Portal Example Using Include Tags

11.2.3.1.1 Portal Example Using inline Tags

This section describes how esi:inline tag fragmentation and assembly can drastically increase the value of dynamic content caching for pages that do not contain real-time elements. It shows how to apply the esi:inline tag for an existing application that supports non-fetchable fragments. The esi:inline tag helps reduce space consumption and improves cache hit ratios by isolating the dynamic content. Note: If an application supports independently fetchable fragments, it is possible to use the esi:inline for fetchable fragments by setting the fetchable attribute to yes. See Section 11.4.5 for further information about the fetchable attribute.