In the Objects Expire section, select After Cache Entry and enter 60 in the

Caching with Third-Party Application Servers 12-11

12.4.2 Cookie_Jscript ASP

Cookie_JScript.asp illustrates how your script can set and read cookies by using the Response.Cookies collection. Use it to demonstrate how Oracle Web Cache caches pages with session cookies. To start, perform the following steps:

1. Ensure that Oracle Web Cache has been configured to communicate with IIS, as

described in Section 12.1.1 .

2. Start IIS, verify that your browser is set to accept cookies, and then access the

following URL: http:hostnameIISSamplessdkaspinteractionCookie_JScript.asp When you access the URL, notice that the page displays the date and time you last visited this page. When you click Revisit this page, the date and time is updated. To cache this content: 1. Create an expiration rule, as described in Section 6.7 . In the Create Expiration Policy dialog, perform the following steps:

a. In the Objects Expire section, select After Cache Entry and enter 60 in the

Time Limit field.

b. In the Action on Expired Objects section, select Remove Immediately.

2. Create a session caching rule, as described in Section 6.8.6 . When configuring a session caching rule, perform the following steps:

a. When creating a session definition in the Session Definitions section of the

Session Configuration page: In the Session Name field, enter MSSession. In the Cookie Name field, enter CookieJSCript. In the URL Post Body Parameters field, enter jsessionid. b. In the Session Policy Configuration section of the Session Configuration page, create two policies named MSSession: In the Cache column for the first MSSession policy, select the With Session option. In the Cache column for the second MSSession policy, select the Without Session option. Do not select the Substitute Default Value check box. c. Create a new caching rule for Cookie_JScript.asp. When creating the caching rule for the Cookie_JScript.asp output, configure the following in the General tab of the Create Caching Rule page: Click the Cache check box. From the Expiration list, select Expire 60 seconds after cache entry and remove immediately . In the Match URL By section, enter IISSamplessdkaspinteractionCookie_JScript.asp. In the HTTP Methods section, click GET. 12-12 Oracle Fusion Middleware Administrators Guide for Oracle Web Cache In the Sessions tab of Create Caching Rule page, select both the MSSSession sessions, one using setting Without Session and the other using setting With Session . 3. Point the browser to Oracle Web Cache with the following URL: http:web_cache_hostname:WebCache-admin_ port eIISSamplessdkaspinteractionCookie_JScript.asp See Section 2.11.1.1 to determine the port. The output is the same when you accessed Cookie_JScript.asp directly from IIS. This time, Oracle Web Cache caches the Cookie_JScript.asp output. To verify that the cache serves the content, click Revisit this page. Notice that the date and time are not updated. This is because Oracle Web Cache serves the cached content, and the request never goes to IIS. 4. View the contents of the cache, as described in Section 8.6 , to ensure that Cookie_ JScript.asp is cached. When you reload the page, notice that the cached response appears faster than when you access IIS server directly. Because the expiration rule for this URL is set to 60 seconds, Oracle Web Cache expires the cached content after 60 seconds and reflects the content the next time the user requests the page.