Resolves the link
@param linkRequest Link request
@return Link metadata (never null)
340642
@NotNull
  @SuppressWarnings({ "null", "unused" })
  Link processRequest(@NotNull LinkRequest linkRequest) {

    // detect link type - first accepting wins
    LinkType linkType = null;
    List<Class<? extends LinkType>> linkTypes = linkHandlerConfig.getLinkTypes();
    if (linkTypes == null || linkTypes.isEmpty()) {
      throw new RuntimeException("No link types defined.");
    }
    for (Class<? extends LinkType> candidateLinkTypeClass : linkTypes) {
      LinkType candidateLinkType = AdaptTo.notNull(adaptable, candidateLinkTypeClass);
      if (candidateLinkType.accepts(linkRequest)) {
        linkType = candidateLinkType;
        break;
      }
    }
    Link link = new Link(linkType, linkRequest);

    // preprocess link before resolving
    List<Class<? extends LinkProcessor>> linkPreProcessors = linkHandlerConfig.getPreProcessors();
    if (linkPreProcessors != null) {
      for (Class<? extends LinkProcessor> processorClass : linkPreProcessors) {
        LinkProcessor processor = AdaptTo.notNull(adaptable, processorClass);
        link = processor.process(link);
        if (link == null) {
          throw new RuntimeException("LinkPreProcessor '" + processor + "' returned null, page '" + (currentPage != null ? currentPage.getPath() : "-") + "'.");
        }
      }
    }

    // resolve link
    if (linkType != null) {
      link = linkType.resolveLink(link);
      if (link == null) {
        throw new RuntimeException("LinkType '" + linkType + "' returned null, page '" + (currentPage != null ? currentPage.getPath() : "-") + "'.");
      }
    }

    // generate markup (if markup builder is available) - first accepting wins
    List<Class<? extends LinkMarkupBuilder>> linkMarkupBuilders = linkHandlerConfig.getMarkupBuilders();
    if (linkMarkupBuilders != null) {
      for (Class<? extends LinkMarkupBuilder> linkMarkupBuilderClass : linkMarkupBuilders) {
        LinkMarkupBuilder linkMarkupBuilder = AdaptTo.notNull(adaptable, linkMarkupBuilderClass);
        if (linkMarkupBuilder.accepts(link)) {
          link.setAnchor(linkMarkupBuilder.build(link));
          break;
        }
      }
    }

    // postprocess link after resolving
    List<Class<? extends LinkProcessor>> linkPostProcessors = linkHandlerConfig.getPostProcessors();
    if (linkPostProcessors != null) {
      for (Class<? extends LinkProcessor> processorClass : linkPostProcessors) {
        LinkProcessor processor = AdaptTo.notNull(adaptable, processorClass);
        link = processor.process(link);
        if (link == null) {
          throw new RuntimeException("LinkPostProcessor '" + processor + "' returned null, page '" + (currentPage != null ? currentPage.getPath() : "-") + "'.");
        }
      }
    }

    return link;
  }
291547
public String getContextUrl(HttpServletRequest request) {
        StringBuffer url = request.getRequestURL();
        String context = request.getContextPath();
        String contextUrl = url.substring(0, url.indexOf(context)
                + context.length());
        return contextUrl;
    }
789277
protected String buildQueryString(Request request)
    {
        MultiMap resolvedParameters = null;
        if(parameterFactory != null)
        {
            resolvedParameters = parameterFactory.getParameters();
        }

        if(hasEntries(resolvedParameters))
            resolvedParameters = resolvedParameters.merge(request.getParameters());
        else
            resolvedParameters = request.getParameters();

        if(authorizationFactory != null)
        {
            MultiMap authEntries = authorizationFactory.getParameters();
            if(hasEntries(authEntries))
                resolvedParameters = resolvedParameters.merge(authEntries);
        }


        int ct = 0;
        StringBuilder sb = new StringBuilder(512);
        for (Map.Entry<String, List<String>> entry : resolvedParameters.entries())
        {
            for (String value : entry.getValue())
            {
                if(ct++ > 0)
                    sb.append("&");
                sb.append(encode(entry.getKey())).append("=").append(encode(value));
            }
        }

        return sb.toString();
    }
131095
public static @Nullable GrailsWebRequest lookup(HttpServletRequest request) {
        GrailsWebRequest webRequest = (GrailsWebRequest) request.getAttribute(GrailsApplicationAttributes.WEB_REQUEST);
        return webRequest == null ? lookup() : webRequest;
    }
400415
private void resolve(LinkRelation rel) {
    Iterator<LinkRelationRef> refs = rel.getLinkRelationRefs().iterator();
    while (refs.hasNext()) {
      LinkRelationRef ref = refs.next();
      LinkRelation referencedRel = linkRelations.stream()
          .filter(item -> StringUtils.equals(item.getRel(), ref.getRel()))
          .findFirst().orElse(null);
      if (referencedRel == null) {
        refs.remove();
      }
      else {
        if (StringUtils.isBlank(ref.getShortDescription())) {
          ref.setShortDescription(referencedRel.getShortDescription());
        }
      }
    }
  }
823541
protected List<String> resolveEventFromHttpRequest(final HttpServletRequest request) {
        val mfaRequestHeader = casProperties.getAuthn().getMfa().getRequestHeader();
        val headers = request.getHeaders(mfaRequestHeader);
        if (headers != null && headers.hasMoreElements()) {
            LOGGER.debug("Received request header [{}] as [{}]", mfaRequestHeader, headers);
            return Collections.list(headers);
        }

        val mfaRequestParameter = casProperties.getAuthn().getMfa().getRequestParameter();
        val params = request.getParameterValues(mfaRequestParameter);
        if (params != null && params.length > 0) {
            LOGGER.debug("Received request parameter [{}] as [{}]", mfaRequestParameter, params);
            return Arrays.stream(params).collect(Collectors.toList());
        }

        val attributeName = casProperties.getAuthn().getMfa().getSessionAttribute();
        val session = request.getSession(false);
        var attributeValue = session != null ? session.getAttribute(attributeName) : null;
        if (attributeValue == null) {
            LOGGER.trace("No value could be found for session attribute [{}]. Checking request attributes...", attributeName);
            attributeValue = request.getAttribute(attributeName);
        }

        if (attributeValue == null) {
            LOGGER.trace("No value could be found for [{}]", attributeName);
            return null;
        }

        val values = CollectionUtils.toCollection(attributeValue);
        LOGGER.debug("Found values [{}] mapped to attribute name [{}]", values, attributeName);
        return values.stream().map(Object::toString).collect(Collectors.toList());
    }
630950
protected Content getLinkForClass(Content link, LinkInfo linkInfo, Type type) {
		if (linkInfo.isTypeBound && linkInfo.excludeTypeBoundsLinks) {
			//Since we are excluding type parameter links, we should not
			//be linking to the type bound.
			link.addContent(type.typeName());
			link.addContent(getTypeParameterLinks(linkInfo));
			return null;
		}
		linkInfo.classDoc = type.asClassDoc();
		final Content nlink = newContent();
		nlink.addContent(getClassLink(linkInfo));
		if (linkInfo.includeTypeAsSepLink) {
			nlink.addContent(getTypeParameterLinks(linkInfo, false));
		}
		return nlink;
	}
1185616
def linkcode_resolve(domain, info):
    """"""
    module_name = info['module']
    fullname = info['fullname']
    attribute_name = fullname.split('.')[-1]
    base_url = 'https://github.com/fmenabe/python-dokuwiki/blob/'

    if release.endswith('-dev'):
        base_url += 'master/'
    else:
        base_url += version + '/'

    filename = module_name.replace('.', '/') + '.py'
    module = sys.modules.get(module_name)

    # Get the actual object
    try:
        actual_object = module
        for obj in fullname.split('.'):
            parent = actual_object
            actual_object = getattr(actual_object, obj)
    except AttributeError:
        return None

    # Fix property methods by using their getter method
    if isinstance(actual_object, property):
        actual_object = actual_object.fget

    # Try to get the linenumber of the object
    try:
        source, start_line = inspect.getsourcelines(actual_object)
    except TypeError:
        # If it can not be found, try to find it anyway in the parents its
        # source code
        parent_source, parent_start_line = inspect.getsourcelines(parent)
        for i, line in enumerate(parent_source):
            if line.strip().startswith(attribute_name):
                start_line = parent_start_line + i
                end_line = start_line
                break
        else:
            return None

    else:
        end_line = start_line + len(source) - 1

    line_anchor = '#L%d-L%d' % (start_line, end_line)

    return base_url + filename + line_anchor
975470
static GraphNode getServiceNode(HttpServletRequest request) {
        final IRI serviceUri = new IRI(getFullRequestUrl(request));
        final Graph resultGraph = new SimpleGraph();
        return new GraphNode(serviceUri, resultGraph);
    }
360255
public Content getLink(LinkInfoImpl linkInfo) {
        LinkFactoryImpl factory = new LinkFactoryImpl(this);
        return factory.getLink(linkInfo);
    }
328054
public void createLinks(ServiceReference<S> declarationBinderRef) {
        for (D declaration : linkerManagement.getMatchedDeclaration()) {
            if (linkerManagement.canBeLinked(declaration, declarationBinderRef)) {
                linkerManagement.link(declaration, declarationBinderRef);
            }
        }
    }
748355
private static void resolveOneLink(ArrayResource array, CDAField field, String locale,
                                     CDARichNode node) {
    if (node instanceof CDARichHyperLink
        && ((CDARichHyperLink) node).data instanceof Map) {
      final CDARichHyperLink link = (CDARichHyperLink) node;
      final Map<String, Object> data = (Map<String, Object>) link.data;
      final Object target = data.get("target");

      if (target instanceof Map) {
        if (isLink(target)) {
          final Map<String, Object> map = (Map<String, Object>) target;
          final Map<String, Object> sys = (Map<String, Object>) map.get("sys");
          final String linkType = (String) sys.get("linkType");
          final String id = (String) sys.get("id");

          if ("Asset".equals(linkType)) {
            link.data = array.assets().get(id);
          } else if ("Entry".equals(linkType)) {
            link.data = array.entries().get(id);
          }

        } else {
          throw new IllegalStateException("Could not parse content of data field '"
              + field.id() + "' for locale '" + locale + "' at node '" + node
              + "'. Please check your content type model.");
        }
      } else if (target == null && data.containsKey("uri")) {
        link.data = data.get("uri");
      }
    } else if (node instanceof CDARichParagraph) {
      for (final CDARichNode child : ((CDARichParagraph) node).getContent()) {
        resolveOneLink(array, field, locale, child);
      }
    }
  }
832071
public static String getDomain(HttpServletRequest request) {

		if (request == null) {
			return null;
		}

		return UrlUtils.resolveDomain(request.getServerName());
	}
700015
public Nfs3LinkResponse sendLink(NfsLinkRequest request) throws IOException {
        Nfs3LinkResponse response = new Nfs3LinkResponse();
        _rpcWrapper.callRpcNaked(request, response);
        return response;
    }
47523
public static ResolvingException wrap(RRequest request, Exception e) {
        if (e instanceof ResolvingException) return (ResolvingException) e;
        return new ResolvingException(request, e);
    }
378951
function resolveLink(path) {
  var links = readLinkRecursive(path);
  var resolved = p.resolve.apply(null, links);

  trace('links', links, 'resolves to', resolved);

  return resolved;
}
592193
public static @NotNull Resource getSyntheticLinkResource(@NotNull ResourceResolver resourceResolver, @NotNull String mediaRef) {
    Map<String, Object> map = new HashMap<>();
    map.put(LinkNameConstants.PN_LINK_TYPE, ID);
    map.put(LinkNameConstants.PN_LINK_MEDIA_REF, mediaRef);
    return new SyntheticLinkResource(resourceResolver, map);
  }