Accessing Built-In Objects Via Customized Components

If a customized component requires access to built-in objects, it must extend halc.com.iASPContext. iASPContext provides three methods (getServer(), getRequest(), getResponse()), and you can retrieve the parent of any built-in object from a customized component by calling these methods directly.

There are two types of syntax you can use to accomplish this:


Server.CreateObject (ProgID [,ProgID Constructor parameter list])

EXAMPLE (where ProgName.java is a customized component)

package Demo;
public class ProgName{
public String name = "sssssss";
        public ProgName(String s,Double d)
        {
name = s;
        } 
}
  • If both Demo.ProgNameBeanInfo.class and Demo.ProgName.class exist, then Demo.ProgNameBeanInfo.class represents a bean.
  • If only Demo.ProgNameBeanInfo.class exists, it is considered a class.
  • If Demo.ProgNameBeanInfo.class does not exist, it is considered a VisiBroker Corba object name.

Remarks:

Before creating an instance of Demo.ProgName.class, your CLASSPATH must contain Demo.ProgName.class and you must add the following code to the .asp file:

<% set progname = Server.CreateObject("Demo.ProgName","winapp",3.456) %>

As described above, if both  and  exist,  represents a bean. If only   exists, it represents a class. If  does not exist, it is considered a VisiBroker Corba object name.


ServerCreateObject (*.jar,[ProgID[,ProgID Constructor parameter list]])

When using this syntax, it is not necessary for the .jar to be located in the CLASSPATH, but it should exist in the virtual site.

Remarks:

The Server.CreateObject (*.jar) syntax lets you browse all beans contained in the .jar file as well as their properties and methods. For programming details, please consult the  Samples/General/CreateObject sample.

ProgID represents the bean contained in the jar file.

For example, if you need create an instance of sunw.demo.buttons.ExplicitButton in the buttons.jar file, you can add the following code to the .asp file (buttons.jar does not need to exist in CLASSPATH, but it should exist on the virtual site):

<%
   set explicit = Server.CreateObject("..\jar\buttons.jar","sunw.demo.buttons.ExplicitButton")
%>

NOTE: ProgID is case-sensitive but the fields and methods of ProgID are not case-sensitive.

If you encounter any problems or errors, please contact support@halcyonsoft.com


Copyright © 1998-2002, Halcyon Software Inc. All rights reserved.