The Content Handler API (CHAPI) defined in JSR-211 is
a Series 40-specific optional API that lets an application invoke registered
applications by URL, by content type, or by content handler ID. The application
can use actions provided by the handler on the invoked content. For example,
an image-viewing MIDlet can be registered to handle the MIME type image/png
.
Other applications can then request the handler to display the image.
The API is supported in Series 40 with clarifications detailed in the Content Handler API (JSR-211): Implementation Notes. The API was introduced in Series 40 5th Edition, Feature Pack 1.
The handler can provide multiple actions that control how the content is displayed, modified, or returned. The execution model utilizes the Application Management Software (AMS) of the device to provide a smooth user experience, to control the execution of the applications, to conserve resources, and to enforce the security policy of the device and the JavaTM runtime environment.
The Content Handler API includes functions to:
Invoke a content handler and get a response
Register an application as a content handler
Query registrations
Respond to an invocation
Registration allows a MIDlet to be associated with one or more content types and to be invoked from other applications to handle content. Multiple content handlers can be registered for the types, suffixes and actions. An application can use the URL, type, ID, or action to invoke the content handler. The handler to be invoked is selected based on the type, ID, and action requested.
The block diagram below indicates general relationships between the CHAPI package, the native operating system (OS), the Java Runtime Environment (Configuration and Profiles), and other optional packages that may be present in a device.
Content Handler API use cases can be roughly divided into two categories:
Distributing content with a proprietary file extension that a MIDlet uses.
Assigning established content types to a specific application.
More defined use cases include:
Distributing new game levels
Upgrading software with new features
Invoking content stored on the device
Invoking a specific application
Getting an email address from a local or remote phone book