If you choose to provide users with a URL or add a hyperlink to a Web site, then you can use a key map file to simplify or hide parameters in your URL requests. This section provides the following information:
The key map file contains command strings for running reports, each headed by a unique key identifier. Except when you run a report as a JSP, you reference only this key in the runtime URL. Oracle Reports Servlet (
rwservlet) sends the key value to the key map file (
cgicmd.dat), which in turn returns the command associated with the specified key to
rwservlet for processing. By using key mapping, the command line options are all hidden from the user.
Shortening the URL, making it more convenient to use.
Remapping the runtime commands without having to change the original URL.
Standardizing several typical run configurations for your company.
Hiding certain parameters from users (for example, the database connect string).
Restricting the parameters users can use to run a report.
When you specify a key name from the key map file (
cgicmd.dat), it must always be at the beginning of the query string (after the question mark) in a report request URL. An exception to this is if you use the
CMDKEY command line keyword, and express the key name as its value:
keyname. In this case, you can place the key name anywhere in the query string within the report request URL. The
CMDKEY keyword can be used with jobs run as JSPs and with the
Note:See Section A.5.14, "CMDKEY" for more information.
Key mapping is enabled when a valid file with the standard file name,
cgicmd.dat, is present in the default location:
$DOMAIN_HOME/servers/WLS_REPORTS/stage/reports/reports/configuration/cgicmd.dat directory on the Web server machine (on either Windows or UNIX).
Navigate to the
cgicmd.dat file on the machine that hosts your Reports Server, and open it with a text editor.
You'll find this file in the following directory on both Windows and UNIX:
Add a key mapping entry. For example:
key1: report=your_report.rdf userid=username/password@my_db desformat=html SERVER=server_name destype=cache
In this example,
key1 is the name of the key.
Except for the special parameters that are described in the file itself, the command line options follow the syntax rules of
rwclient. See Section A.2.1, "rwclient" for more information.
Add or update the hyperlinks on your Web page.
For more information, see Section 17.5, "Specifying a Report Request from a Web Browser".
The key name is case-sensitive; that is, it must exactly match the case specified in the key mapping file (
The URL might be:
The key mapping file (
cgicmd.dat) might contain:
run_report: report=myreport deptno=%1 myparam=%2 %*
This generates the equivalent of the following command line request:
rwclient report=myreport deptno=par1 myparam=par2 parN
When you run a report as a JSP and want to call a command key in the
cgicmd.dat file, you must use the
cmdkey keyword in your URL. The
cmdkey value (
keyname) is case-sensitive; that is, it must exactly match the case specified in the
cgicmd.dat file. For example, your JSP URL might look like this:
Note:You can also use
When you use
cmdkey with a JSP or
rwservlet, you can place it anywhere within the query string. For example:
When using key mapping, the order in which the parameters are substituted from the URL into the key is determined by the placement of
cmdkey in the URL. For example, suppose you have a key such as the following in the
mykeys: DEPTNO=%1 MYPARAM=%2
Now, you execute a JSP report that references this key as follows:
Because of the placement of
cmdkey in this URL, the
10 corresponds to
test corresponds to
%2. Even though they are not the first and second parameters in the URL,
test are the first and second parameters to follow
cmdkey in the URL. In this example, the URL becomes: