*
* @since 3.0.2
*/
public static String getDynamicMediaURI(AbstractComponent comp,
int version, String name, String format) {
final Desktop desktop = comp.getDesktop();
if (desktop == null) return ""; //no avail at client
final StringBuffer sb = new StringBuffer(64).append('/');
Strings.encode(sb, version & 0xffff);
if (name != null || format != null) {
sb.append('/');
boolean bExtRequired = true;
if (name != null && name.length() != 0) {
name = name.replace('\\', '/');
if (name.charAt(0) == '/') {
name = name.substring(1);
if (name.length() == 0) name = "ua";
}
sb.append(name);
bExtRequired = name.lastIndexOf('.') < 0;
} else {
sb.append(comp.getId());
}
if (bExtRequired && format != null)
sb.append('.').append(format);
}
return desktop.getDynamicMediaURI(comp, sb.toString()); //already encoded
}