In this section: How to: |
A WebFOCUS Servlet WFTRANSINOUT plug-in is a custom-written program which, when configured, is called by the WebFOCUS Client as the last step prior to sending each request to the Reporting Server and again as the first step when receiving output from the Reporting Server.
WFTRANSINOUT plug-ins must implement the WFTransInOutInterface.
This plug-in is enabled by specifying the fully qualified package and class name in the WFTRANSINOUT variable in the General settings on the Configuration menu of the WebFOCUS Administration Console. The WFTRANSINOUT servlet variable must point to a java class that implements the ibi.webfoc.wfapi.WFTransInOutInterface class. The following methods must be implemented in the java class:
To configure your WebFOCUS Servlet plug-in, you must set the WFTRANSINOUT servlet variable to the fully qualified name of the package and class that implements the WFTransInOutInterface:
By default, this setting is blank.
Note:
Reference: |
This section outlines the method signatures required to create a WebFOCUS Servlet WFTRANSINOUT plug-in.
Constructor for WFTransInOutInterface. The Constructor is shared by all WebFOCUS Servlet Exit requests.
Function that specifies which methods, transin, transout or both, are enabled.
Returns:
String of comma-separated flags. The string will contain in if transin should be enabled and out if transout should be enabled. For example, to enable only transout, the string is out. To enable both transin and transout, the string is in,out.
Function to modify output from the WebFOCUS Reporting Server.
Parameters:
Data from WebFOCUS Reporting Server to be modified.
Specifies the type of data coming from the WebFOCUS Reporting Server, for example .html .xml
Returns:
Modified data read from WebFOCUS Reporting Server.
Function to modify input to WebFOCUS Reporting Server.
Parameters:
String with fex to modify before sending to the WebFOCUS Reporting Server.
Returns:
Modified procedure content.
The following sample WFTRANSINOUT plug-in uses the wfTransout method to write the string returned from the WebFOCUS Reporting Server to a log file, using code page 1255.
//package com.exit; import ibi.webfoc.wfapi.WFTransInOutInterface; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.io.UnsupportedEncodingException; /** * TransInOutSample.java * @author IBI * Aug 21, 2004 * @version 7.1: * */ public class TransInOutExit implements WFTransInOutInterface { private static final String TRANSIN= "in"; private static final String TRANSOUT= "out"; private static final String TRANSINOUT= TRANSIN + "," + TRANSOUT; /** * Constructor for TransInOutExit. */ public TransInOutExit() { super(); } /** * Modify input sent to WF Reporting Server. * @param arg0 String to be modified. * @return String containing modified content. In this sample program, the Transin method is not being used. */
public String wfTransin(String arg0) { return null; } /** * Modify output returned from WF Reporting Server. * @param arg0 String output sent from WFRS to be modified. * @param arg1 String Type of output, (i.e. .HTM, .PDF, etc...). * @return byte[] Modified content. In this sample program, the Transout method writes the string sent from the WFRS, using code page 1255, to a log file called c:\temp\testout.log. */ public byte[] wfTransout(byte[] arg0, String arg1) { byte[] bret= new byte[arg0.length]; for (int i= 0; i< arg0.length; i++) { Byte b= new Byte(arg0[i]); bret[i]= arg0[arg0.length - i - 1]; } String str; BufferedWriter out= null; try { str= new String(arg0, 0, 7, "cp1255"); out= new BufferedWriter(new FileWriter("c:\\temp\\testout.log", true)); out.write(new String(arg0, "cp1255")); out.write("\n"); out.close(); } catch (UnsupportedEncodingException e) { throw (new RuntimeException(e.toString())); } catch (IOException e) { throw (new RuntimeException(e.toString())); } finally { try { out.close(); } catch (IOException e1) { throw (new RuntimeException(e1.toString())); } } return arg0; } /** * Determines which functions to call, in=wfTransin, out=wfTransout. * @return String of comma-separated flags, in,out : in : out. */ public String wfEnableInOut() { // return(TRANSIN); //call wfTransin only return(TRANSOUT); //call wfTransout only //return (TRANSINOUT); //call both wfTransin and wfTransout } }
WebFOCUS |