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.
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.
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.
The following <CALL> command invokes a WebFOCUS plug-in.
<CALL> routine(parm1,parm2) <IF> RETCODE NE "returncodevalue" # insert your code here <ENDIF>
where:
Is the command that invokes the WebFOCUS Servlet plug-in.
Defines the name of the actual function to be called (for example, security or CopyHTTPCookieToWFVar).
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.
Is the status of the method call.
Is the value you are comparing to what the plug-in returns (for example, 0).
The CopyHTTPHeaderToWFVar method copies the value of an HTTP Header variable into a WebFOCUS Servlet variable.
HTTP_HEADER_NAME = hostWFS_VAR_NAME = WFV <CALL> CopyHTTPHeaderToWFVar (HTTP_HEADER_NAME,WFS_VAR_NAME) <SET> WFV (pass)
where:
Is the name of the HTTP header entry from which the value is retrieved.
Is the value retrieved.
Is the name of the WebFOCUS Servlet variable that receives the value.
Is the value assigned to the WebFOCUS Servlet variable.
A return code of 0 (zero) indicates success and 999 indicates failure.
-TYPE &WFV
The web server name in the HTTP header is copied into a WebFOCUS Servlet variable.
The CopyWFVarToSessionVar method copies the value of a WebFOCUS Servlet variable into a web application session variable.
<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.
Sign in as an administrator.
<IFDEF> IBIMR_user SESSION_VAR_NAME = sampleVariable WFS_VAR_NAME = &IBIMR_user <CALL> CopyWFVarToSessionVar (WFS_VAR_NAME, SESSION_VAR_NAME) <ENDIF>
where:
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.
Is the name of the web application session variable.
This function always returns 0 (zero).
When you run the sample.jsp file, the session variable displays the user ID you provided on the Sign in page.
The CopySessionVarToWFVar method copies the value of a web application session variable into a WebFOCUS Servlet variable.
<%@ 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.
Sign in as an administrator.
SESSION_VAR_NAME = sampleVariable WFS_VAR_NAME = WFV <CALL> CopySessionVarToWFVar (SESSION_VAR_NAME,WFS_VAR_NAME) <SET> WFV (pass)
where:
Is the name of the web application session variable.
Is the name of the WebFOCUS Servlet variable that receives the value.
A return code of 0 (zero) indicates success and 999 indicates failure.
-TYPE &WFV
The application server session variable and its associated value are copied to the WebFOCUS Servlet variable and displayed.
The CopyHTTPMethodToWFVar method copies a value representing the HTTP request type into a WebFOCUS Servlet variable. The request type is usually GET or POST.
Sign in as an administrator.
WFS_VAR_NAME = WFV <CALL> CopyHTTPMethodToWFVar (WFS_VAR_NAME) <SET> WFV (pass)
where:
Is the name of the WebFOCUS Servlet variable that receives the value.
A return code of 0 (zero) indicates success and 999 indicates failure.
-TYPE &WFV
Depending on how the WebFOCUS Servlet is called, a GET or POST operator is displayed.
The CopyHTTPCookieToWFVar method copies the contents of an HTTP cookie into a WebFOCUS Servlet variable.
Sign in as an administrator.
COOKIE_NAME = WF_SESSIONID WFS_VAR_NAME = WFV <CALL> CopyHTTPCookieToWFVar (COOKIE_NAME,WFS_VAR_NAME) <SET> WFV (pass)
where:
Is the name of the HTTP cookie from which the value is retrieved.
Is the name of the WebFOCUS Servlet variable that receives the value.
A return code of 0 (zero) indicates success and 999 indicates failure.
-TYPE &WFV
The contents of an HTTP cookie are displayed. In this case, the HTTP cookie is the WF_SESSIONID cookie.
The following <IF> statement conditionally checks WebFOCUS Client variables.
<IF> variable operator value <ELSE> <ENDIF>
where:
Is any WebFOCUS Client variable.
Can be set to EQ, NE, CONTAINS, OR, or AND.
Applies to any WebFOCUS Client variable or constant.
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>
The following <IFDEF> statement checks for the existence of a WebFOCUS Client variable.
<IFDEF> variable <ELSE> <ENDIF>
where:
Is any WebFOCUS Client 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>
The following <IFNDEF> statement checks to see whether a WebFOCUS Client variable does not exist.
<IFNDEF> variable <ELSE> <ENDIF>
where:
Is any WebFOCUS Client variable.
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:
Is a Dialogue Manager variable to be used by the WebFOCUS Server.
Is a literal value. If you include quotation marks ("), they are passed in as part of the variable. Applies to any WebFOCUS Client variable.
Is a placeholder for a value. Applies to any WebFOCUS Client variable.