TIBCO WebFOCUS Servlet Plug-in

In this section:

How to:

The TIBCO WebFOCUS Servlet plug-in contains methods for manipulating WebFOCUS variables. Since the parameters passed to each of these methods cannot be literal values, the values must first be placed into variables, where they can then be used in the method call.

For a list of HTTP header variables placed in the WebFOCUS variable table, see HTTP Header Variables Available for Script Processing.

Procedure: How to Enable the TIBCO WebFOCUS Servlet Plug-in

The TIBCO WebFOCUS Servlet plug-in is enabled by setting the WFEXT variable to the class name ibi.webfoc.WFEXTDefault in the webfocus.cfg file.

  1. In the Security Center, on the Configuration tab, under the Application Settings folder, click Client Settings.
  2. If the class name ibi.webfoc.WFEXTDefault is not displayed as the value of the Plugin Class (IBI_WFEXT) setting, type it, and then click Save.

Note: Only one plug-in can be active at a time. If you need to add additional functionality, you should extend this class to include your functionality, so that you do not lose access to the methods provided in this class.

Syntax: How to Invoke the TIBCO WebFOCUS Servlet Plug-in

The following <CALL> command invokes a WebFOCUS plug-in.

<CALL> routine(parm1,parm2) 
<IF> RETCODE NE "returncodevalue"
# insert your code here
<ENDIF>

where:

<CALL>

Is the command that invokes the WebFOCUS Servlet plug-in.

routine

Defines the name of the actual function to be called (for example, security or CopyHTTPCookieToWFVar).

(parm1,parm2)

Are the input parameters of the WebFOCUS plug-in. Each WebFOCUS plug-in can contain a maximum of ten input parameters. The output buffer is passed, but does not contribute to the maximum number of input parameters.

RETCODE

Is the status of the method call.

returncodevalue

Is the value you are comparing to what the plug-in returns (for example, 0).

CopyHTTPHeaderToWFVar Method

The CopyHTTPHeaderToWFVar method copies the value of an HTTP Header variable into a WebFOCUS Servlet variable.

Example: Using the CopyHTTPHeaderToWFVar Method

  1. In the Administration Console, on the Configuration tab, click Custom Settings and in the Custom Settings window type the following code:
    HTTP_HEADER_NAME = hostWFS_VAR_NAME = WFV
    <CALL> CopyHTTPHeaderToWFVar (HTTP_HEADER_NAME,WFS_VAR_NAME)
    <SET> WFV (pass)

    where:

    HTTP_HEADER_NAME

    Is the name of the HTTP header entry from which the value is retrieved.

    host

    Is the value retrieved.

    WFS_VAR_NAME

    Is the name of the WebFOCUS Servlet variable that receives the value.

    WFV

    Is the value assigned to the WebFOCUS Servlet variable.

    A return code of 0 (zero) indicates success and 999 indicates failure.

  2. Run the following procedure from within a Business Intelligence Portal (BIP):
    -TYPE &WFV

The web server name in the HTTP header is copied into a WebFOCUS Servlet variable.

CopyWFVarToSessionVar Method

The CopyWFVarToSessionVar method copies the value of a WebFOCUS Servlet variable into a web application session variable.

Example: Using the CopyWFVarToSessionVar Method

  1. Navigate to the folder drive:/ibi/WebFOCUS82/webapps/webfocus, open a text editor, and type or copy and paste the following code:
    <HTML>
    <BODY>
    Session variable value is <%= session.getAttribute("sampleVariable")%>
    </BODY>
    </HTML>

    Note: The sample.jsp file uses the session.getAttribute method to retrieve the value of the web application session variable.

  2. Save the file as sample.jsp, and close the text editor.
  3. Sign in as an administrator.

  4. In the Administration Console, on the Configuration tab, click Custom Settings, and then type the following code:
    <IFDEF> IBIMR_user
    SESSION_VAR_NAME = sampleVariable 
    WFS_VAR_NAME = &IBIMR_user
    <CALL> CopyWFVarToSessionVar (WFS_VAR_NAME, SESSION_VAR_NAME)
    <ENDIF>

    where:

    WFS_VAR_NAME

    Is the name of the WebFOCUS Servlet variable. The value of this variable is the name of the actual WebFOCUS variable whose value is copied into the web application session variable.

    SESSION_VAR_NAME

    Is the name of the web application session variable.

    This function always returns 0 (zero).

  5. Click Save.
  6. When you receive a message that the file was saved successfully, click OK.
  7. Sign in to the BI Portal.
  8. In the same browser window, type http://hostname:port/ibi_apps/sample.jsp in the address bar and press the Enter key.

When you run the sample.jsp file, the session variable displays the user ID you provided on the Sign in page.

CopySessionVarToWFVar Method

The CopySessionVarToWFVar method copies the value of a web application session variable into a WebFOCUS Servlet variable.

Example: Using the CopySessionVarToWFVar Method

  1. Navigate to the folder drive:/ibi/WebFOCUS82/webapps/webfocus, open a text editor, and type or copy and paste the following code:
    <%@ page language="java" contentType="text/html"%>
    <%  session.setAttribute("sampleVariable","sampleValue"); %>

    Note: The sample.jsp file uses the session.setAttribute method to initialize a web application session variable.

  2. Save the file as sample.jsp, and close the text editor.
  3. Sign in as an administrator.

  4. In the Administration Console, on the Configuration tab, click Custom Settings, and then type the following code:
    SESSION_VAR_NAME = sampleVariable
    WFS_VAR_NAME = WFV 
    <CALL> CopySessionVarToWFVar (SESSION_VAR_NAME,WFS_VAR_NAME)
    <SET> WFV (pass)

    where:

    SESSION_VAR_NAME

    Is the name of the web application session variable.

    WFS_VAR_NAME

    Is the name of the WebFOCUS Servlet variable that receives the value.

    A return code of 0 (zero) indicates success and 999 indicates failure.

  5. Run the following procedure from within a Business Intelligence Portal (BIP):
    -TYPE &WFV

    The application server session variable and its associated value are copied to the WebFOCUS Servlet variable and displayed.

CopyHTTPMethodToWFVar Method

The CopyHTTPMethodToWFVar method copies a value representing the HTTP request type into a WebFOCUS Servlet variable. The request type is usually GET or POST.

Example: Using the CopyHTTPMethodToWFVar Method

  1. Sign in as an administrator.

  2. In the Administration Console, on the Configuration tab, click Custom Settings, and then type the following code:
    WFS_VAR_NAME = WFV 
    <CALL> CopyHTTPMethodToWFVar (WFS_VAR_NAME) 
    <SET> WFV (pass)

    where:

    WFS_VAR_NAME

    Is the name of the WebFOCUS Servlet variable that receives the value.

    A return code of 0 (zero) indicates success and 999 indicates failure.

  3. Run the following procedure from within a Business Intelligence Portal (BIP):
    -TYPE &WFV

Depending on how the WebFOCUS Servlet is called, a GET or POST operator is displayed.

CopyHTTPCookieToWFVar Method

The CopyHTTPCookieToWFVar method copies the contents of an HTTP cookie into a WebFOCUS Servlet variable.

Example: Using the CopyHTTPCookieToWFVar Method

  1. Sign in as an administrator.

  2. In the Administration Console, on the Configuration tab, click Custom Settings, and then type the following code:
    COOKIE_NAME = WF_SESSIONID 
    WFS_VAR_NAME = WFV 
    <CALL> CopyHTTPCookieToWFVar (COOKIE_NAME,WFS_VAR_NAME) 
    <SET> WFV (pass)

    where:

    COOKIE_NAME

    Is the name of the HTTP cookie from which the value is retrieved.

    WFS_VAR_NAME

    Is the name of the WebFOCUS Servlet variable that receives the value.

    A return code of 0 (zero) indicates success and 999 indicates failure.

  3. Run the following procedure from within a Business Intelligence Portal (BIP):
    -TYPE &WFV

The contents of an HTTP cookie are displayed. In this case, the HTTP cookie is the WF_SESSIONID cookie.

Syntax: How to Conditionally Check Variables

The following <IF> statement conditionally checks WebFOCUS Client variables.

<IF> variable operator value 
<ELSE>
<ENDIF>

where:

variable

Is any WebFOCUS Client variable.

operator

Can be set to EQ, NE, CONTAINS, OR, or AND.

value

Applies to any WebFOCUS Client variable or constant.

Example: Conditionally Checking Variables in Uppercase

You can use the following <IF> statement to ensure that the Sign in page is invoked.

If you add upper to a WFS variable, the value is checked as if it has all uppercase characters. This allows you to check the value that the user entered without worrying about the case.

The following <IF> statement ensures that any value entered is treated as uppercase.

<IF> ABC.upper EQ "Y" OR ABC.upper EQ "YES"
DEF = &GHI
<ENDIF>

The following <IF> statement ensures that any server value entered is not case-sensitive.

<IF> IBIC_server.upper EQ "EDASERV"
# INSERT YOUR CODE HERE....
<ENDIF>

The following <IF> statement checks whether or not the constant .ibi.com is contained in the WebFOCUS Client variable HTTP_HOST.

<IF> HTTP_HOST contains ".ibi.com"
# INSERT YOUR CODE HERE....
<ENDIF>

Syntax: How to Check for the Existence of a Variable

The following <IFDEF> statement checks for the existence of a WebFOCUS Client variable.

<IFDEF> variable 
<ELSE>
<ENDIF>

where:

variable

Is any WebFOCUS Client variable.

Example: Checking for and Defining a Variable

In the following example, if the variable _ON_NT exists, PATH_SEP is set to a semicolon (;). If the variable _ON_NT does not exist, PATH_SEP is set to a colon (:).

<IFDEF> _ON_NT
PATH_SEP=; 
<ELSE> PATH_SEP=: 
<ENDIF>

Syntax: How to Check Whether a Variable Does Not Exist

The following <IFNDEF> statement checks to see whether a WebFOCUS Client variable does not exist.

<IFNDEF> variable 
<ELSE>
<ENDIF>

where:

variable

Is any WebFOCUS Client variable.

Syntax: How to Send Variables to the TIBCO WebFOCUS Server

The <SET> command sends variables to the WebFOCUS Server for use with server procedures. Certain custom variables are sent to the WebFOCUS Server automatically. This syntax is used for variables that are not automatically sent to the WebFOCUS Server.

<SET> name = {constant|&variable} (pass)

where:

name

Is a Dialogue Manager variable to be used by the WebFOCUS Server.

constant

Is a literal value. If you include quotation marks ("), they are passed in as part of the variable. Applies to any WebFOCUS Client variable.

&variable

Is a placeholder for a value. Applies to any WebFOCUS Client variable.