Oracle® Application Server Web Cache Sample Code and Demos README
10g Release 2 (10.1.2) |
|
Copyright © 2005, Oracle. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Sample Code and Demos README
10g Release 2 (10.1.2)
2005
OracleAS Web Cache ships with sample source code and scripts that enable you to better customize applications for OracleAS Web Cache features.The $ORACLE_HOME/webcache/examples
directory on UNIX and
ORACLE_HOME\webcache\examples
directory on Windows contains the following sample code for generating invalidation requests with OracleAS Web Cache. You can create invalidation tools following these examples and use them with your applications.
EncodeBase64.java
for a Java invalidation API
EncodeBase64.java
helps encode the password using Base 64 encoding, which is used by OracleAS Web Cache to authenticate in order to connect to the invalidation port. To use this code:
Set the CLASSPATH
environment variable to include the $ORACLE_HOME/webcache/examples
(UNIX) or ORACLE_HOME
\webcache\examples
(Windows) directory.
Compile with javac EncodeBase64.java
.
Run java EncodeBase64
to see usage examples.
wxvutil.sql
and wxvappl.sql
for a PL/SQL invalidation API
To use these APIs, launch SQL*Plus to load the packages into the database and invoke the appropriate procedures. For further information, read the detailed comments at the beginning of the source files.
invalidate.c
for C source
invalidate.c
demonstrates invalidation using C. It allows you to send simple invalidation messages to OracleAS Web Cache using C APIs. To use this code on UNIX:
Compile with cc -c invalidate.c
.
Link with cc -o invalidate invalidate.o -lxnet
.
Run invalidate
to see usage examples.
To use this code on Windows:
Open invalidate.c
in Visual Studio.
Click F7 to link and create a project.
Add wsock32.lib
to the link section under the project setting.
Click F7 again.
Run invalidate
to see usage examples.
Invalidate.java
and WCSInvalidate.java
for Java source
These code samples demonstrate invalidation using Java. It allows you to send simple invalidation message to OracleAS Web Cache. To use this code:
Set the CLASSPATH
environment variable to include the $ORACLE_HOME/webcache/examples
and $ORACLE_HOME/webcache/toolkit
directories on UNIX operating systems, or ORACLE_HOME
\webcache\examples
and ORACLE_HOME
\webcache\toolkit
directories for Windows operating systems.
Compile with javac Invalidate.java
or javac WCSInvalidate.java
together with its dependent submodules SyncObject.java
and SSLVerifier.java
.
Run java Invalidate
or java WCSInvalidate
to see usage examples.
invalidate.sh
invalidate.sh
invalidates documents with a telnet session. When using this shell script:
Replace <
webcache_hostname
>
with the host name of the computer that OracleAS Web Cache is running on.
Replace <
webcache_invalidation_port
>
with the invalidation port number. The default port number is 9401.
Replace <
webcache_invalidation_password
>
with the invalidation password. The default password is invalidator
.
invalidate.txt
is a transcript for doing invalidation by using invalidate.sh
. It shows an unsuccessful result of invalidating a document that is not currently in cache. It then shows the output for invalidation of a document that is currently cached.
The response from OracleAS Web Cache is not printed for most telnet implementations.
invalidate.pl
invalidate.pl
demonstrates invalidation using PERL. It allows you to send simple invalidation message to OracleAS Web Cache using PERL APIs. To use this code, run invalidate.pl
to see the usage.
invalidate.sql
invalidate.sql
demonstrates invalidation using PL/SQL. It allows you to send simple invalidation message to OracleAS Web Cache using PL/SQL APIs. To use this code:
Load invalidate.sql
into database .
At the prompt, enter the following:
set serveroutput on; exec invalidate('host', 9401, 'invalidator', 'http://host:port/cache.htm');
invalidate.pl
invalidate.pl
demonstrates invalidation using PERL. It allows you to send simple invalidation message to OracleAS Web Cache using PERL APIs. To use this code, run invalidate.pl
to see the usage.
inv-trigger.sql
inv-trigger.sql
is a PL/SQL script that creates a database trigger to call PL/SQL invalidation APIs upon a data change. It requires wxvutil.sql
, described in OracleAS Web Cache Invalidation APIs README. inv-trigger.sql
creates the EMPL
tables, adds a few records, and then creates a database trigger that calls wxvutil.sql
.
After successfully running inv-trigger.sql
, execute the trigger with an INSERT
, UPDATE
, or DELETE
with SQL*Plus. For example:
SQL> INSERT INTO empl values (2, 'Jose','407-497-1937'); commit;
This statement fires the trigger.
To demo this trigger:
Run wxutil.sql
.
Install the required tables, create sample data, and create the database trigger with inv-trigger.sql
.
Set up a caching rules for some document that you want to test.
The default is set to http://www.host.com/cache.htm
.
Execute an INSERT
, UPDATE
, or DELETE
statement on the table.
Reload http://www.host.com/cache.htm
.
Watch the event log file for a cache miss.
The following event log excerpt shows an initial request:
[28/Jan/2005:01:16:31 +0000] [detail] [ecid: 25088736934,0] [client:10.10.150.35] [host: www.host.com:80] [url:cache.htm] [28/Jan/2005:01:16:31 +0000] [trace 11414] [ecid: 25088736934,0]Inital cache key is composed: http://www.host.ccom:80/cache.htm . [28/Jan/2005:01:16:31 +0000] [trace 11415] [ecid: 25088736934,0] Final cache key is composed: http://www.host.com:80/cache.htm ;gzip.
The following excerpt shows the reloading request:
[28/Jan/2005:01:16:31 +0000] [debug 11436] [ecid: 25088736934,0] www.host.com:80/cache.htm: cached document'sexpiration and removal timestamps are updated to be 433336 and 433336, respectively, after a validated response. [28/Jan/2005:01:16:31 +0000] [trace 11092] [ecid: 25088736934,0] Document validated for www.host.com:80/cache.htm
See Also: OracleAS Web Cache Invalidation APIs README for information about invalidation APIs shipped with OracleAS Web Cache |
Oracle Technology Network (OTN) provides additional demos and sample code that demonstrate the features of OracleAS Web Cache. To access the location of these demos and code, point your browser to:
http://www.oracle.com/technology/sample_code/products/ias/web_cache/index.html
Our goal is to make Oracle products, services, and supporting documentation accessible, with good usability, to the disabled community. To that end, our documentation includes features that make information available to users of assistive technology. This documentation is available in HTML format, and contains markup to facilitate access by the disabled community. Standards will continue to evolve over time, and Oracle is actively engaged with other market-leading technology vendors to address technical obstacles so that our documentation can be accessible to all of our customers. For additional information, visit the Oracle Accessibility Program Web site at
http://www.oracle.com/accessibility/