@Test public void getSrc_WithFallback() { final String expected = "/content/dam/fallback.png"; ctx.currentResource("/content/no-rendition-name"); final Image image = ctx.request().adaptTo(Image.class); assertEquals(expected, image.getSrc()); }
@Override public String getSrc() { if (src == null) { String tmp = null; if (!isLegacyMode()) { if (asset != null && StringUtils.isNotBlank(renditionName)) { final AssetRenditionParameters parameters = new AssetRenditionParameters(asset, renditionName, false); tmp = assetRenditions.getUrl(request, asset, parameters); } } else { tmp = getLegacySrc(); } if (StringUtils.isBlank(tmp)) { tmp = fallbackSrc; } src = UrlUtil.escape(tmp); } return src; }
ImageImpl extends AbstractEmptyTextComponent implements Image { @Override public String getSrc() { if (src == null) { String tmp = null; if (!isLegacyMode()) { if (asset != null && StringUtils.isNotBlank(renditionName)) { final AssetRenditionParameters parameters = new AssetRenditionParameters(asset, renditionName, false); tmp = assetRenditions.getUrl(request, asset, parameters); } } else { tmp = getLegacySrc(); } if (StringUtils.isBlank(tmp)) { tmp = fallbackSrc; } src = UrlUtil.escape(tmp); } return src; } }
ImageImpl extends AbstractEmptyTextComponent implements Image { @Override public String getSrc() { if (src == null) { String tmp = null; if (!isLegacyMode()) { if (asset != null && StringUtils.isNotBlank(renditionName)) { final AssetRenditionParameters parameters = new AssetRenditionParameters(asset, renditionName, false); tmp = assetRenditions.getUrl(request, asset, parameters); } } else { tmp = getLegacySrc(); } if (StringUtils.isBlank(tmp)) { tmp = fallbackSrc; } src = UrlUtil.escape(tmp); } return src; }  }
ImageImpl extends AbstractEmptyTextComponent implements Image { @Override public String getSrc() { if (src == null) { String tmp = null; if (!isLegacyMode()) { if (asset != null && StringUtils.isNotBlank(renditionName)) { final AssetRenditionParameters parameters = new AssetRenditionParameters(asset, renditionName, false); tmp = assetRenditions.getUrl(request, asset, parameters); } } else { tmp = getLegacySrc(); } if (StringUtils.isBlank(tmp)) { tmp = fallbackSrc; } src = UrlUtil.escape(tmp); } return src; }  @PostConstruct void init(); @Override String getSrc(); @Override String getAlt(); @Override String getFallback(); @Override boolean isEmpty(); @Override boolean isReady(); @Nonnull @Override String getExportedType(); }
ImageImpl extends AbstractEmptyTextComponent implements Image { @Override public String getSrc() { if (src == null) { String tmp = null; if (!isLegacyMode()) { if (asset != null && StringUtils.isNotBlank(renditionName)) { final AssetRenditionParameters parameters = new AssetRenditionParameters(asset, renditionName, false); tmp = assetRenditions.getUrl(request, asset, parameters); } } else { tmp = getLegacySrc(); } if (StringUtils.isBlank(tmp)) { tmp = fallbackSrc; } src = UrlUtil.escape(tmp); } return src; }  @PostConstruct void init(); @Override String getSrc(); @Override String getAlt(); @Override String getFallback(); @Override boolean isEmpty(); @Override boolean isReady(); @Nonnull @Override String getExportedType();  }