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 a input data for a content creator method. The data should be serializable because it is encoded to the URL to 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 'cachable' is set to false, the request will 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