/** * Build JSON metadata for one rendition as image source. * @param media Media * @param rendition Rendition * @return JSON metadata */ @SuppressWarnings("null") protected JSONObject toReponsiveImageSource(Media media, Rendition rendition) { try { JSONObject source = new JSONObject(); MediaFormat mediaFormat = rendition.getMediaFormat(); source.put(MediaNameConstants.PROP_BREAKPOINT, mediaFormat.getProperties().get(MediaNameConstants.PROP_BREAKPOINT)); source.put(PROP_SRC, rendition.getUrl()); return source; } catch (JSONException ex) { throw new RuntimeException("Error building JSON source.", ex); } }