a4j:mediaOutput allows to generate images, video, sounds and other binary resources defined by a user on-the-fly.

createContent attribute references to the method that will be used for content creating. The method accepts two parameters. The first parameter has an OutputStream type. It is a reference to the steam that should be used for output. The second parameter is a reference to a 'value' attribute of the component.

value attribute references to data that can be used as input data for a content creator method. The data should be serializable because it is encoded to the URL of the resource.

mimeType attribute defines the type of output content. It is used to define the corresponded type in the header of an HTTP response.

cacheable attribute is a flag that defines the caching strategy. If 'cacheable' is set to false, the response will not be cached. If it is set to true, it will be cached and the serialized value of 'value' attribute plays the role of a cache key.

MediaOutput example

Note for SWF sample. Using scripts loading strategy different from "ALL" you should use additionally load swfObject script by using: <a4j:loadScript src="resource:///org/richfaces/renderkit/html/js/swfobject.js" />