Featured interfaces

javax.microedition.content.ContentHandlerServer

This interface provides methods for accessing and processing new Invocation requests.

An application responds to a new Invocation request in the following two ways:
  • uses the getRequest() method with the parameter wait set to true to block the application and wait for an Invocation request to arrive
  • uses the setListener() method to be notified of new Invocation requests when they become available.

    You must pass in the class that implements the RequestListener interface into the setListener() method. When a new request arrives, the application invokes the method invocationRequestNotify(). To retrieve the invocation, use the getRequest() method with the wait parameter set to false. Setting the wait parameter to false prevents the application from blocking and, therefore, does not necessarily make sure that the Invocation is still available. You should check that the Invocation returned by getRequest() is not null before processing it in this case.

The sample application uses the setListener() method to wait for an Invocation request without blocking. The setListener() method is called in the SendMediaDemo() constructor. Since the SendMediaDemo class contains the implementation of the RequestListener interface, the setListener() method takes the parameter this.

When an invoking application invokes the sample application as a content handler, the sample application retrieves the Invocation request in the invocationrequestNotify() method using the getRequest() method with the wait parameter set to false.

javax.microedition.content.RequestListener

This interface provides one method, invocationRequestNotify(), which is invoked when a new Invocation is available on the ContentHandlerServer. This method passes in the parameter handler, which is a reference to the ContentHandlerServer object that contains the Invocation object.

The sample application implements this method in the SendMediaDemo class. The method checks if the type of Invocation request is for an image or a video file and invokes the appropriate method, displayImage() or displayVideo(), for the content type.

Next topic: Featured classes
Previous topic: Overview

Was this information helpful? Send us your comments.