Source:
public final ResourceLink build(final HttpServletRequest request, final User user, final Contentlet contentlet, final String velocityVarName) throws DotDataException, DotSecurityException { final File binary = Try.of(()->contentlet.getBinary(velocityVarName)).getOrNull(); final Identifier identifier = getIdentifier(contentlet); if (binary==null || identifier == null && UtilMethods.isEmpty(identifier.getInode())){ return new ResourceLink(StringPool.BLANK, StringPool.BLANK, StringPool.BLANK, null, StringPool.BLANK, false, true); } final boolean downloadRestricted = isDownloadPermissionBasedRestricted(contentlet, user); final StringBuilder resourceLink = new StringBuilder(); final StringBuilder resourceLinkUri = new StringBuilder(); Host host = getHost((String)request.getAttribute(HOST_REQUEST_ATTRIBUTE) , user); if(null == host){ host = getHost(contentlet.getHost(), user); } resourceLink.append(request.isSecure()? HTTPS_PREFIX:HTTP_PREFIX); resourceLink.append(host.getHostname()); if(request.getServerPort() != 80 && request.getServerPort() != 443) { resourceLink.append(StringPool.COLON).append(request.getServerPort()); } resourceLinkUri.append(identifier.getParentPath()).append(binary.getName()); resourceLink.append(UtilMethods.encodeURIComponent(resourceLinkUri.toString())); resourceLinkUri.append(LANG_ID_PARAM).append(contentlet.getLanguageId()); resourceLink.append(LANG_ID_PARAM).append(contentlet.getLanguageId()); final String mimeType = this.getMimiType(binary); final String fileAssetName = binary.getName(); return new ResourceLink(resourceLink.toString(), resourceLinkUri.toString(), mimeType, contentlet, velocityVarName, isEditableAsText(mimeType, fileAssetName), downloadRestricted); }

Target:
public final ResourceLink build(final HttpServletRequest request, final User user, final Contentlet contentlet, final String velocityVarName) throws DotDataException, DotSecurityException { final File binary = Try.of(()->contentlet.getBinary(velocityVarName)).getOrNull(); final Identifier identifier = getIdentifier(contentlet); if (binary==null || identifier == null && UtilMethods.isEmpty(identifier.getInode())){ return new ResourceLink(StringPool.BLANK, StringPool.BLANK, StringPool.BLANK, null, StringPool.BLANK, false, true, StringPool.BLANK, StringPool.BLANK); } Host host = getHost((String)request.getAttribute(HOST_REQUEST_ATTRIBUTE) , user); if(null == host){ host = getHost(contentlet.getHost(), user); } final StringBuilder hostUrlBuilder = new StringBuilder(request.isSecure()? HTTPS_PREFIX:HTTP_PREFIX); hostUrlBuilder.append(host.getHostname()); if(request.getServerPort() != 80 && request.getServerPort() != 443) { hostUrlBuilder.append(StringPool.COLON).append(request.getServerPort()); } final boolean downloadRestricted = isDownloadPermissionBasedRestricted(contentlet, user); final String mimeType = this.getMimiType(binary); final String fileAssetName = binary.getName(); final Tuple2<String, String> resourceLink = this.createResourceLink(request, user, contentlet, identifier, binary, hostUrlBuilder.toString()); final Tuple2<String, String> versionPathIdPath = this.createVersionPathIdPath(contentlet, velocityVarName, binary); return new ResourceLink(resourceLink._1(), resourceLink._2(), mimeType, contentlet, velocityVarName, isEditableAsText(mimeType, fileAssetName), downloadRestricted, versionPathIdPath._1(), versionPathIdPath._2()); }