Parse a message-destination-link

@param origin original module name.
@param link link provided on the link element
@return
541671
public static Link parseMessageDestinationLink(String origin, String link) {
        return parse(origin, link, false);
    }
789004
protected void getLinkForAnnotationType(Content link, LinkInfo linkInfo, Type type) {
		link.addContent(getTypeAnnotationLinks(linkInfo));
		linkInfo.type = type.asAnnotatedType().underlyingType();
		link.addContent(getLink(linkInfo));
	}
882802
public static String MD5Encode(String origin) {
		String resultString = null;
		try {
			resultString = origin;
			MessageDigest md = MessageDigest.getInstance("MD5");
			md.update(resultString.getBytes("UTF-8"));
			resultString = byteArrayToHexString(md.digest());
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
		return resultString;
	}
1132923
public synchronized final void append(Link link)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "append");

        Link prev = _dummyTail._getPreviousLink();
        link._link(prev, _dummyTail, _nextPositionToIssue++, this);
        prev._setNextLink(link);
        _dummyTail._setPreviousLink(link);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "append", _debugString());
    }
1173427
synchronized void link(final OtpErlangPid from, final OtpErlangPid to)
            throws OtpErlangExit {
        try {
            super.sendLink(from, to);
            links.addLink(from, to);
        } catch (final IOException e) {
            throw new OtpErlangExit("noproc", to);
        }
    }
551365
private void initializeLinkOpen(TimeoutTracker timeout)
	{
		this.linkFirstOpen = new CompletableFuture<CoreMessageSender>();

		// timer to signal a timeout if exceeds the operationTimeout on MessagingFactory
		Timer.schedule(
				new Runnable()
				{
					public void run()
					{
						if (!CoreMessageSender.this.linkFirstOpen.isDone())
						{
							CoreMessageSender.this.closeInternals(false);
							CoreMessageSender.this.setClosed();

							Exception operationTimedout = new TimeoutException(
									String.format(Locale.US, "Open operation on SendLink(%s) on Entity(%s) timed out at %s.",	CoreMessageSender.this.sendLink.getName(), CoreMessageSender.this.getSendPath(), ZonedDateTime.now().toString()),
									CoreMessageSender.this.lastKnownErrorReportedAt.isAfter(Instant.now().minusSeconds(ClientConstants.SERVER_BUSY_BASE_SLEEP_TIME_IN_SECS)) ? CoreMessageSender.this.lastKnownLinkError : null);
							TRACE_LOGGER.warn(operationTimedout.getMessage());
							ExceptionUtil.completeExceptionally(CoreMessageSender.this.linkFirstOpen, operationTimedout, CoreMessageSender.this, true);
						}
					}
				}
				, timeout.remaining()
				, TimerType.OneTimeRun);
	}
1129764
@SuppressWarnings("static-method")
	protected void getLinkForPrimitive(Content link, LinkInfo linkInfo, Type type) {
		link.addContent(type.typeName());
	}
968626
public final void available(AbstractItemLink link) throws SevereMessageStoreException
    {
        if (_jumpbackEnabled)
        {
            final long newPos = link.getPosition();

            // we need to synchronize the read of the position
            // or we can miss out items when reading an empty queue fast.
            // More importantly, the removal of the next from the cursor cannot
            // happen while we are adding the available
            synchronized(this)
            {
                if (newPos <= _highestPosition)
                {
                    // Only store matching links, 'coz its quicker
                    if (null != link.matches(_filter))
                    {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "availableLink adding: " + link);

                        _behindList.insert(link);
                    }
                    else
                    {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "availableLink does not match: " + link);
                    }
                }
                else
                {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "availableLink seq(" + newPos + ") too large (" + _highestPosition + ")");
                }
            }
        }
        else
        {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "available link - jumpbackDisabled: " + link);
        }
    }
830957
public static String makeDeepLink(String link){

        if(link != null
                // If getCurrentRemoteConnectionLink() == null means there is no current remote connection
                && getCurrentRemoteConnectionLink() != null
                // If containsRemoteParameter(link) is true means link already contain remote connection parameter
                && !containsRemoteParameter(link)) {

            link += (link.contains("?") ? "&" : "?") + PARAM_REMOTE_CONNECTION + "=" + getCurrentRemoteConnectionLink();

        }

        return link;

    }
1006158
public static String replaceServerUri(String link, String server) {

        String serverUriStr = server;

        if (CmsStringUtil.isEmptyOrWhitespaceOnly(serverUriStr)) {
            return link;
        }
        try {
            URI serverUri = new URI(serverUriStr);
            URI linkUri = new URI(link);
            URI result = new URI(
                serverUri.getScheme(),
                serverUri.getAuthority(),
                linkUri.getPath(),
                linkUri.getQuery(),
                linkUri.getFragment());
            return result.toString();
        } catch (URISyntaxException e) {
            LOG.error(e.getLocalizedMessage(), e);
            return link;
        }

    }
741669
public HttpUrl resolve(String link) {
        Builder builder = newBuilder(link);
        return builder != null ? builder.build() : null;
    }
241410
static Message readMessageFromDelivery(Receiver receiveLink, Delivery delivery)
	{
	    int msgSize = delivery.pending();
        byte[] buffer = new byte[msgSize];
        
        int read = receiveLink.recv(buffer, 0, msgSize);
        
        Message message = Proton.message();
        message.decode(buffer, 0, read);
        return message;	    
	}
966711
public static EntityGetOperation<ContentKeyAuthorizationPolicyInfo> get(
            LinkInfo<ContentKeyAuthorizationPolicyInfo> link) {
        return new DefaultGetOperation<ContentKeyAuthorizationPolicyInfo>(link.getHref(),
                ContentKeyAuthorizationPolicyInfo.class);
    }
1290849
private void readRelationship(Link link)
   {
      Task sourceTask = m_taskIdMap.get(link.getSourceTaskID());
      Task destinationTask = m_taskIdMap.get(link.getDestinationTaskID());
      if (sourceTask != null && destinationTask != null)
      {
         Duration lag = getDuration(link.getLagUnit(), link.getLag());
         RelationType type = link.getType();
         Relation relation = destinationTask.addPredecessor(sourceTask, type, lag);
         relation.setUniqueID(link.getID());
      }
   }
302593
function toAbsoluteLinks(data, originUrl) {

        var host = getHost(stripTrailingSlash(originUrl));

        function prefixLinks(links) {
            if (host) {
                angular.forEach(links, function (linkValue, linkKey) {
                    if (linkValue.href.charAt(0) === '/') {
                        linkValue.href = host + linkValue.href;
                        links[linkKey] = linkValue;
                    }
                });
            }
        }

        function walkTree(node, action) {

            action(node[config.linksKey]);

            angular.forEach(node[config.embeddedKey], function (embedded) {
                if (embedded instanceof Array) {
                    angular.forEach(embedded, function (embeddedItem) {
                        walkTree(embeddedItem, action);
                    });

                } else {
                    walkTree(embedded, action);

                }
            });
        }

        walkTree(data, prefixLinks);

    }
684554
private String parseDestinationHeader( final WebdavRequest req, final WebdavResponse resp )
        throws IOException
    {
        String destinationPath = req.getHeader( "Destination" );

        if ( destinationPath == null )
        {
            resp.sendError( WebdavStatus.SC_BAD_REQUEST );
            return null;
        }

        // Remove url encoding from destination
        destinationPath = RequestUtil.URLDecode( destinationPath, "UTF8" );

        final int protocolIndex = destinationPath.indexOf( "://" );
        if ( protocolIndex >= 0 )
        {
            // if the Destination URL contains the protocol, we can safely
            // trim everything upto the first "/" character after "://"
            final int firstSeparator = destinationPath.indexOf( "/", protocolIndex + 4 );
            if ( firstSeparator < 0 )
            {
                destinationPath = "/";
            }
            else
            {
                destinationPath = destinationPath.substring( firstSeparator );
            }
        }
        else
        {
            final String hostName = req.getServerName();
            if ( ( hostName != null ) && ( destinationPath.startsWith( hostName ) ) )
            {
                destinationPath = destinationPath.substring( hostName.length() );
            }

            final int portIndex = destinationPath.indexOf( ":" );
            if ( portIndex >= 0 )
            {
                destinationPath = destinationPath.substring( portIndex );
            }

            if ( destinationPath.startsWith( ":" ) )
            {
                final int firstSeparator = destinationPath.indexOf( "/" );
                if ( firstSeparator < 0 )
                {
                    destinationPath = "/";
                }
                else
                {
                    destinationPath = destinationPath.substring( firstSeparator );
                }
            }
        }

        // Normalize destination path (remove '.' and' ..')
        destinationPath = normalize( destinationPath );

        final String contextPath = req.getContextPath();
        if ( ( contextPath != null ) && ( destinationPath.startsWith( contextPath ) ) )
        {
            destinationPath = destinationPath.substring( contextPath.length() );
        }

        final String pathInfo = req.getPathInfo();
        if ( pathInfo != null )
        {
            final String servletPath = req.getServicePath();
            if ( ( servletPath != null ) && ( destinationPath.startsWith( servletPath ) ) )
            {
                destinationPath = destinationPath.substring( servletPath.length() );
            }
        }

        return destinationPath;
    }
473126
function resolveLink(srcUrl, targetUrl) {
  // Parse the src URL
  var srcUrlObj = url.parse(srcUrl);

  // If there isn't a protocol
  // DEV: `node@0.8` has this as `undefined`, `node@0.10` has this as `null`
  if (!srcUrlObj.protocol) {
    // With no protocol, we have everything in pathname. Add on `//` and force treatment of `host`
    var tmpSrcUrl = '//' + srcUrl;
    var tmpSrcUrlObj = url.parse(tmpSrcUrl, null, true);

    // If this new hostname has a TLD, then keep it as the srcUrlObj
    // DEV: We are trading accuracy for size (technically not all dots mean a tld
    //   If we want to be accurate, use https://github.com/ramitos/tld.js/blob/305a285fd8f5d618417178521d8729855baadb37/src/tld.js
    if (tmpSrcUrlObj.hostname && tldRegexp.test(tmpSrcUrlObj.hostname)) {
      srcUrl = tmpSrcUrl;
      srcUrlObj = tmpSrcUrlObj;
    }
  }

  // Fallback pathname
  srcUrlObj.pathname = srcUrlObj.pathname || '/';

  // If we still have no protocol
  // DEV: `node@0.8` has this as `undefined`, `node@0.10` has this as `null`
  if (!srcUrlObj.protocol) {
    // Parse our targetUrl
    var targetUrlObj = url.parse(targetUrl);

    // If there is a hostname
    // DEV: `node@0.8` has this as `undefined`, `node@0.10` has this as `null`
    if (srcUrlObj.hostname) {
      // If the hostname is the same as our original, add on a protocol
      if (srcUrlObj.hostname === targetUrlObj.hostname) {
        srcUrlObj.protocol = targetUrlObj.protocol;
      // Otherwise, default to HTTP
      } else {
        srcUrlObj.protocol = 'http:';
      }
    // Otherwise, pickup the target protocol and hostname
    } else {
      srcUrlObj.protocol = targetUrlObj.protocol;
      srcUrlObj.hostname = targetUrlObj.hostname;
    }
  }

  // Return our completed src url
  return url.format(srcUrlObj);
}