Apache Tomcat Session Servlet

Caching with Third-Party Application Servers 12-9

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 ApacheSession. In the Cookie Name field, enter JSESSION. 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 ApacheSession: In the Cache column for the first ApacheSession policy, select the With Session option. In the Cache column for the second ApacheSession policy, select the Without Session option. Do not select the Substitute Default Value check box. c. Create a new caching rule for Session. When creating the caching rule for the SessionServlet servlet 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, select Path Prefix and enter examplesservletsSessionServlet. In the HTTP Methods section, click GET. In the Sessions tab of Create Caching Rule page, select both the ApacheSession sessions, one using setting Without Session and the other using setting With Session. 3. Create a session caching rule as described in Section 6.8.6 . 4. Point the browser to Oracle Web Cache with the following URL: http:web_cache_hostname:WebCache-adminexamplesservletsSessionServlet See Section 2.11.1.1 to determine the port. The output is the same when you accessed Session servlet directly from Apache Tomcat. This time Oracle Web Cache caches the Session servlet output. When the page is refreshed or reloaded, notice that the counter does not increment by one. This is because Oracle Web Cache serves the content, and the request never goes to the Apache Tomcat. 5. View the contents of the cache, as described in Section 8.6 , to ensure that Session servlet is cached. When you reload the page, notice that the cached response appears faster than when you access the Apache Tomcat server directly. 12-10 Oracle Fusion Middleware Administrators Guide for Oracle Web Cache 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.

12.4 Microsoft IIS

The Microsoft IIS installation includes several ASP examples. This section explains how to configure Oracle Web Cache to cache the following content: ■ Section 12.4.1, ServerVariables_Jscript ASP ■ Section 12.4.2, Cookie_Jscript ASP

12.4.1 ServerVariables_Jscript ASP

ServerVariables_JScript.asp demonstrates techniques you can use to access server variable information from an ASP script. Use it to demonstrate how Oracle Web Cache caches full-page dynamic content. To start, perform the following steps:

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

described Section 12.1.1 .

2. Start IIS, and then access the following URL:

http:hostnameIISSamplessdkaspinteractionServerVariables_JScript.asp Notice that request information, headers, and parameters sent by the browser display. To cache this content: 1. Create a caching rule for the ServerVariables_JScript.asp, as described in Section 6.8 , using the following information:, configure the following in the Create Caching Rule page: When creating the caching rule for the ServerVariables_JScript.asp output, configure the following in the Create Caching Rule page: ■ In the Match URL By section, enter: IISSamplessdkaspinteractionServerVariables_JScript.asp ■ In the HTTP Methods section, click GET. ■ In the Caching Response section, click Cache. 2. Point the browser to Oracle Web Cache with following URL: http:web_cache_hostname:WebCache-admin_ port eIISSamplessdkaspinteractionServerVariables_JScript.asp See Section 2.11.1.1 to determine the port. The output is the same when you accessed ServerVariables_JScript.asp directly from IIS. This time, Oracle Web Cache caches the ServerVariables_ JScript.asp output and serves the request to the browser. 3. View the contents of the cache, as described in Section 8.6 , to ensure that ServerVariables_JScript.asp is cached. When you reload the page, you should notice that the cached response appears faster than when you access IIS directly. 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.