PhotoAlbum Application Download Support Developer Guide
Skins:
Resources/Beans Handling
Ajax Miscellaneous
Usage
Tag Information

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

createContent attribute references to the managed Bean 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 some managed Bean with data that can be used as input data for a content creator method. The object 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

Dynamically generated JPEG file:



SWF Movie:





View JPEG Example Source


View SWF Example Source


View MediaBean.java Source


View MediaData.java Source

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" />

RichFaces Wiki RichFaces Project Site