if (icon.getUri().isAbsolute()) { errors.add(new ValidationError( getClass(), "icons", "Local icon URI can not be absolute: " + icon.getUri() )); if (icon.getUri().toString().contains("../")) { errors.add(new ValidationError( getClass(), "icons", "Local icon URI must not contain '../': " + icon.getUri() )); if (icon.getUri().toString().startsWith("/")) { errors.add(new ValidationError( getClass(), "icons", "Local icon URI must not start with '/': " + icon.getUri() ));
public URI getIconPath(Icon icon) { return appendPathToBaseURI(getDevicePath(icon.getDevice()) + "/" + icon.getUri().toString()); }
@Override public String toString() { return "Icon(" + getWidth() + "x" + getHeight() + ", MIME: " + getMimeType() + ") " + getUri(); } }
discovered.add(new IconResource(namespace.prefixIfRelative(this, icon.getUri()), icon));
public Icon deepCopy() { return new Icon( getMimeType(), getWidth(), getHeight(), getDepth(), getUri(), getData() ); }
new StreamRequestMessage(UpnpRequest.Method.GET, device.normalizeURI(usableIcon.getUri()));
protected void generateIconList(Namespace namespace, Device deviceModel, Document descriptor, Element deviceElement) { if (!deviceModel.hasIcons()) return; Element iconListElement = appendNewElement(descriptor, deviceElement, ELEMENT.iconList); for (Icon icon : deviceModel.getIcons()) { Element iconElement = appendNewElement(descriptor, iconListElement, ELEMENT.icon); appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.mimetype, icon.getMimeType()); appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.width, icon.getWidth()); appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.height, icon.getHeight()); appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.depth, icon.getDepth()); if (deviceModel instanceof RemoteDevice) { appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.url, icon.getUri()); } else if (deviceModel instanceof LocalDevice) { appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.url, namespace.getIconPath(icon)); } } }
public URI getIconPath(Icon icon) { return URI.create(getPath(icon.getDevice()).toString() + "/" + icon.getUri().toString()); }
if (icon.getUri().isAbsolute()) { errors.add(new ValidationError( getClass(), "icons", "Local icon URI can not be absolute: " + icon.getUri() )); if (icon.getUri().toString().contains("../")) { errors.add(new ValidationError( getClass(), "icons", "Local icon URI must not contain '../': " + icon.getUri() )); if (icon.getUri().toString().startsWith("/")) { errors.add(new ValidationError( getClass(), "icons", "Local icon URI must not start with '/': " + icon.getUri() ));
@Override public String toString() { return "Icon(" + getWidth() + "x" + getHeight() + ", MIME: " + getMimeType() + ") " + getUri(); } }
discovered.add(new IconResource(namespace.prefixIfRelative(this, icon.getUri()), icon));
public Icon deepCopy() { return new Icon( getMimeType(), getWidth(), getHeight(), getDepth(), getUri(), getData() ); }
protected void generateIconList(Namespace namespace, Device deviceModel, Document descriptor, Element deviceElement) { if (!deviceModel.hasIcons()) return; Element iconListElement = appendNewElement(descriptor, deviceElement, ELEMENT.iconList); for (Icon icon : deviceModel.getIcons()) { Element iconElement = appendNewElement(descriptor, iconListElement, ELEMENT.icon); appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.mimetype, icon.getMimeType()); appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.width, icon.getWidth()); appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.height, icon.getHeight()); appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.depth, icon.getDepth()); if (deviceModel instanceof RemoteDevice) { appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.url, icon.getUri()); } else if (deviceModel instanceof LocalDevice) { appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.url, namespace.getIconPath(icon)); } } }
public URI getIconPath(Icon icon) { return appendPathToBaseURI(getDevicePath(icon.getDevice()) + "/" + icon.getUri().toString()); }
@Override public String toString() { return "Icon(" + getWidth() + "x" + getHeight() + ", MIME: " + getMimeType() + ") " + getUri(); } }
public Icon deepCopy() { return new Icon( getMimeType(), getWidth(), getHeight(), getDepth(), getUri(), getData() ); }
protected void generateIconList(Namespace namespace, Device deviceModel, Document descriptor, Element deviceElement) { if (!deviceModel.hasIcons()) return; Element iconListElement = appendNewElement(descriptor, deviceElement, ELEMENT.iconList); for (Icon icon : deviceModel.getIcons()) { Element iconElement = appendNewElement(descriptor, iconListElement, ELEMENT.icon); appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.mimetype, icon.getMimeType()); appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.width, icon.getWidth()); appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.height, icon.getHeight()); appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.depth, icon.getDepth()); if (deviceModel instanceof RemoteDevice) { appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.url, icon.getUri()); } else if (deviceModel instanceof LocalDevice) { appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.url, namespace.getIconPath(icon)); } } }