in myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/media/AbstractMediaRenderer.java [144:179]
protected void renderMediaSources(FacesContext facesContext, UIComponent uiComponent) throws IOException
{
ResponseWriter writer = facesContext.getResponseWriter();
// type check is done above with RendererUtils.checkParamValidity(...)
AbstractMedia component = (AbstractMedia) uiComponent;
// render MediaInfo instances
Set<MediaInfo> mediaInfoSet = component.getMediaInfos();
if (mediaInfoSet != null)
{
for (MediaInfo mediaInfo : mediaInfoSet)
{
if (mediaInfo.isDisabled())
continue;
writer.startElement(HTML5.SOURCE_ELEM, null);
// src is reqired to be present and not empty!
if (mediaInfo.getSrc() == null || mediaInfo.getSrc().length() == 0)
// WIKI: add a wiki page
throw new FacesException("'src' field of MediaInfo has to be defined and nonempty for component " + DebugUtils.getPathToComponent(uiComponent) + ".");
writer.writeAttribute(HTML5.SRC_ATTR, mediaInfo.getSrc(), null);
String typeVal = _getTypeForSource(mediaInfo);
if (typeVal != null) // write even if empty str
writer.writeAttribute(HTML5.TYPE_ATTR, typeVal, null);
if (mediaInfo.getMedia() != null) // write even if empty str
writer.writeAttribute(HTML5.MEDIA_ATTR, mediaInfo.getMedia(), null);
writer.endElement(HTML5.SOURCE_ELEM);
}
}
}