Client Info JavaBean Information

The Client Info JavaBean provides the programmer with information about the client machine that the end user is running on.  This includes information about the IP address of the browser's machine, the O/S username of the user and so on. (see the list below).

The JavaBean can be integrated into the Form at runtime using the FBean package to register and manipulate the bean, or as a conventional Pluggable Java Component. Only the former method is discussed here.  Refer to the JavaDoc for the component if you wish to integrate the bean as a PJC.

Modules In This Demo

The ClientInfo demo consists of the following files (relative directories shown in brackets):

  1. getclientinfo.fmb/fmx [forms]- The demo form
  2. GetClientInfo.java [src/oracle/forms/demos/beans] - source code for the JavaBean class
  3. getclientinfo.jar [classes]- the compiled and jarred java class.  This jar file is signed as the ClientInfo bean needs to operate outside of the Java sandbox in order to obtain information such as the client IP address.

The doc directory and the classes directory contain the JavaDoc for the code and the compiled class respectively.

Reusing the code

Setting up Forms Services

In order for an application to be able to use the ClientInfo JavaBean, the relevant configuration in the formsweb.cfg file has to ensure that the supplied getclientinfo.jar (or another jar file containing the compiled GetClientInfo.class) is included in the relevant archive setting.

An entry in the formsweb.cfg file for an application that used the ClientInfo JavaBean  would look like this:

[Ticker]
pageTitle=OracleAS Forms Services - Client Info Demo
IE=jinitiator
baseHTMLJInitiator=demobasejini.html
archive_jini=frmall_jinit.jar,getclientinfo.jar
form=getclientinfoforms/java
width=675
height=480
separateFrame=false
splashScreen=no
lookAndFeel=oracle
colorScheme=blue
background=/formsdemo/images/blue.gif

Using the Utility as a JavaBean in your Form

Integration with the ClientInfo JavaBean can be achieved at runtime using the Enhanced JavaBean support provided by Oracle Forms.

The first step to create the bean at runtime is to use the FBean.Register() procedure to load the JavaBean into the assigned Bean Area.  This would normally be done at Forms start-up - for instance in the When-New-Form-Instance trigger. FBean.Register() takes three arguments:

In this case the class of the ClientInfo bean is oracle.forms.demos.beans.GetClientInfo. An example call to FBean.Register() would be something like:

FBean.Register_Bean('CTL.CLIENTINFO',1,'oracle.forms.demos.beans.GetClientInfo');

As soon as a bean is registered in this way, Forms will introspect it and internally create interfaces for calling methods and setting / getting properties on the bean using the FBean package.

The ClientInfo JavaBean supports the following operations

So for instance to obtain the client IP Address:

ipaddr := FBean.Invoke_Char('CTL.CLIENTINFO',1,'getIPAddress');

Property and Method Summary

The ClientInfo JavaBean provides the following methods:

Method Arguments Return Value Purpose
getUsername   String  Returns the O/S username of the user running the Form 
getHostname   String Returns the Host Name of the machine that is running the browser containing the Form
getIPAddress   String Returns the IP Address of the machine that is running the browser containing the Form
getDate   String Returns the date and time from the machine that is running the Forms Client
getSystemProperty String (System Property to obtain) String Returns the value of a specified Java system property. See your Java documentation for java.lang.System for a list of valid values.