The Java Component Framework was designed to make accessing the ASP built-in objects from a Java component simple. The framework does this by hiding many of the intricacies of COM object programming from you, allowing you to focus almost exclusively on enhancing the functionality of your component. It is still important, however, to have some understanding of what's happening under the hood. This sample demonstrates the steps that would be necessary to gain access to, and invoke a method in, the built-in Response object if you were not using the Java Component Framework.
This sample uses the Component Services GetObjectContext method to get a pointer to the interface for the context properties, and then uses the GetProperty method of the context properties to get a reference to the actual Response object. The getDispatch method of the Response object is called to get a pointer to the actual dispinterface for the Response object, IResponse. Finally, the IResponse.Write method is used to send "Hello, World!" to the client browser.
Unlike the Hello World sample, this sample component sends "Hello, World!" directly to the client browser instead of returning the string to the caller.
The Java Component Framework makes the tasks demonstrated in this sample even easier by providing methods that you can use to immediately gain access to the correct built-in ASP objects. The framework's AspContext.getResponse contains all of the functionality demonstrated in this sample, but is accessible through just a single call.
This project is available in the ...\iissamples\sdk\components\java\Samples subdirectory of the Internet services directory.