Understanding Page Content Processor JSP

The example JSP that follows processes Business Object XI pages. The JSP processes page content and returns any variables (OPCGIPARAMs) for future processing during CCL playback. It is designed to process Business Objects XI HTTP requests and determine the correct sEntry/logonToken values.

It takes a vector of page contents and processes each one in turn. When finished it places on the request object an attribute named 'variables' that contains any OPCGIPARAM variables that have been set as a result of the processing.

The request attribute “url” contains the URL that was requested that triggered the page loads. The request attribute “content” is a vector of content objects, for each page that was loaded as a result of the target being requested.

NoteSee the notes following the code for more information.

<%--

  This JSP processes page content and returns any variables (OPCGIPARAMs) for
  future processing during CCL playback.  It is designed to process BO XI
  HTTP requests and determine the correct sEntry/logonToken values.

...

  This processing will only work for BO XI.

--%>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
%
boolean debug = false;

String targeturl = (String)request.getAttribute("url");
Vector content = (Vector)request.getAttribute("content");

if (debug) System.out.println("=======================\n\ntarget url: " + targeturl);

// we don't process any URL that isn't directed at the BO XI  server
if (targeturl.indexOf("/businessobjects/enterprise11/") == -1)
   return;

Hashtable vars = new Hashtable();

for (int i = 0; i < content.size(); i++)
{
   // Each content item is a Properties object
   // The 'url' property contains the URL for the content
   // The 'html' property contains the HTML page content
   Properties pageInfo = (Properties)content.elementAt(i);

   String urlStr = pageInfo.getProperty("url");
   String html = pageInfo.getProperty("html");

   if (debug) System.out.println("JSP: url: " + urlStr);
   if (urlStr.indexOf("/InfoView/listing/reportList.do") != -1)
   {

      int idx = html.indexOf("return finalUrl + \"logonToken=");
      if (idx == -1)
      {
         if (debug) System.out.println("No logonToken ...");
      continue;
      }

      int endIdx = html.indexOf("\"", idx+30);
      String logonToken = html.substring(idx+30, endIdx);

      if (debug) System.out.println("JSP: logonToken: " + logonToken);

      Hashtable urlVars = new Hashtable();
      urlVars.put("logonToken", logonToken);
      vars.put(urlStr, urlVars);
      }

   else if (urlStr.indexOf("/viewers/cdz_adv/viewCDZDocument.jsp") != -1)
   {
      int idx = html.indexOf("writeBody(\"report.jsp?sEntry=");
      if (idx == -1)
      {
         if (debug) System.out.println("No strEntry ...");
         continue;
      }

      int endIdx = html.indexOf("&", idx+29);
      String strEntry = html.substring(idx+29, endIdx);

      if (debug) System.out.println("JSP: sEntry: " + strEntry);

      Hashtable urlVars = new Hashtable();
      urlVars.put("sEntry", strEntry);
      vars.put(urlStr, urlVars);        
   }
}

request.setAttribute("variables", vars);
%>

The main things to note are the input request attributes “url” and “content,” and the output request attribute “'variables.”

When UA saves the name/value pairs, it does so under two keys: the simple name, and a key constructed from the URL the name was seen under and the name, as <url>:<name>. For example;

http://www.company.com/path:sEntry

In this example, the URL is http://www.company.com/path, and the OPCGIPARAM key is sEntry. This allows developers to decide whether OPCGIPARAMs are sensitive to URLs or generic across all URLs.

NoteNote that the URL saved is always saved without any query parameters.

The Page Content Processor JSP is executed during web element runtime, such that after each HTTP get or post is recorded in the CCL, and submitted by UA, we call the JSP and present it with the returned HTML page content (as described above).