Creates an absolute url using the given request's url as base and appending optional segments.

@param request a {@code non-null} {@link HttpServletRequest}
@param pathSegments an option array of segments
@return a string representing an absolute-url
965904
public static String urlFrom( HttpServletRequest request,
                                  String... pathSegments ) {
        return urlFrom(request.getRequestURL().toString(), pathSegments);
    }
736782
function reconstructUrl(path,request) {

    //Append query string
    if (Object.keys(request.queryParams).length > 0) {
        var str = [];
        for (var p in request.queryParams) {
            if (request.queryParams.hasOwnProperty(p) && p != '') {
                str.push(p + "=" + request.queryParams[p]);
            }
        }
        if ( str.length > 0 ){
            path += "?" + str.join("&");
        }
    }

    //Fix path parameters
    if (Object.keys(request.pathParams).length > 0) {
        for (var param in request.pathParams) {
            if (request.pathParams.hasOwnProperty(param)) {
                var toReplace = "{" + param + "}";
                path = path.replace(toReplace, request.pathParams[param]);
            }
        }
    }

    return path;
}
851806
protected String buildUrl(AbstractBaseRequest request) throws AbstractCosException {
		String endPoint = this.config.getCosEndPoint();
		int appId = this.cred.getAppId();
		String bucketName = request.getBucketName();
		String cosPath = request.getCosPath();
		cosPath = CommonPathUtils.encodeRemotePath(cosPath);
		return String.format("%s/%s/%s%s", endPoint, appId, bucketName, cosPath);
	}
555799
public static String urlFrom( String baseUrl,
                                  String... pathSegments ) {
        StringBuilder urlBuilder = new StringBuilder(baseUrl);
        if (urlBuilder.charAt(urlBuilder.length() - 1) == '/') {
            urlBuilder.deleteCharAt(urlBuilder.length() - 1);
        }
        for (String pathSegment : pathSegments) {
            if (pathSegment.equalsIgnoreCase("..")) {
                urlBuilder.delete(urlBuilder.lastIndexOf("/"), urlBuilder.length());
            } else {
                if (!pathSegment.startsWith("/")) {
                    urlBuilder.append("/");
                }
                urlBuilder.append(pathSegment);
            }
        }
        return urlBuilder.toString();
    }
351557
private static URL[] pathToURLs(String path) {
        java.util.List<URL> urls = new ArrayList<>();
        for (String s: path.split(Pattern.quote(File.pathSeparator))) {
            if (!s.isEmpty()) {
                URL url = fileToURL(Paths.get(s));
                if (url != null) {
                    urls.add(url);
                }
            }
        }
        return urls.toArray(new URL[urls.size()]);
    }
532001
private URL[] pathToURLs(String path) {
        Set<URL> urls = new LinkedHashSet<URL>();
        for (String s: path.split(File.pathSeparator)) {
            if (s.isEmpty()) continue;
            try {
                urls.add(new File(s).getAbsoluteFile().toURI().toURL());
            } catch (MalformedURLException e) {
                message.error("doclet.MalformedURL", s);
            }
        }
        return urls.toArray(new URL[urls.size()]);
    }
1243152
protected StringBuffer getHeaderSection(HttpServletRequest request) {
		StringBuffer sb = new StringBuffer(mainScriptTemplate.toString());
		sb.append("JAWR.app_context_path='").append(request.getContextPath()).append("';\n");
		return sb;
	}
319859
public static String addQueryStringFragment(String url, String fragment) {
        StringBuilder newUrl = new StringBuilder(url);

        if (fragment.startsWith("?") || fragment.startsWith("&")) {
            fragment = fragment.substring(1);
        }

        if (!url.endsWith("?") && !url.endsWith("&")) {
            if (url.contains("?")) {
                newUrl.append('&');
            } else {
                newUrl.append('?');
            }
        }

        return newUrl.append(fragment).toString();
    }
1369826
public CreatePipelineResponse createPipeline(CreatePipelineRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");
        checkStringNotEmpty(request.getPipelineName(), 
                "The parameter pipelineName should NOT be null or empty string.");
        checkStringNotEmpty(request.getSourceBucket(), 
                "The parameter sourceBucket should NOT be null or empty string.");
        checkStringNotEmpty(request.getTargetBucket(), 
                "The parameter targetBucket should NOT be null or empty string.");
        if (request.getConfig() == null || request.getConfig().getCapacity() == null) {
            PipelineConfig config = new PipelineConfig();
            config.setCapacity(DEFAULT_PIPELINE_CAPACITY);
            request.setConfig(config);
        }
        InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, PIPELINE);
        
        return invokeHttpClient(internalRequest, CreatePipelineResponse.class);
    }
493662
public static String repositoryUrl( HttpServletRequest request ) {
        String requestURL = request.getRequestURL().toString();
        int delimiterSegmentIdx = requestURL.length();
        for (String methodName : ALL_METHODS) {
            if (requestURL.indexOf(methodName) != -1) {
                delimiterSegmentIdx = requestURL.indexOf(methodName);
                break;
            }
        }
        return requestURL.substring(0, delimiterSegmentIdx);
    }
462003
public static String getAbsoluteUrl(SlingHttpServletRequest request, String url) {
        if (!isExternalUrl(url) && url.startsWith("/")) {
            String scheme = request.getScheme().toLowerCase();
            url = scheme + "://" + getAuthority(request) + url;
        }
        return url;
    }
441057
public String getFragmentAdminURL(HttpServletRequest request) {
        IPortalUrlBuilder builder =
                urlProvider.getPortalUrlBuilderByPortletFName(
                        request, PORTLET_FNAME_FRAGMENT_ADMIN_PORTLET, UrlType.RENDER);
        IPortletUrlBuilder portletUrlBuilder = builder.getTargetedPortletUrlBuilder();
        portletUrlBuilder.setPortletMode(PortletMode.VIEW);
        portletUrlBuilder.setWindowState(WindowState.MAXIMIZED);

        return builder.getUrlString();
    }
1058997
public String mapRequestPath(HttpServletRequest request) {

        String endpointName = Path.newInstance(request).firstSegment();
        return StringUtils.lowerCase(endpointName);
    }
96976
private String getRelativePath(HttpServletRequest request) {

        String result = request.getPathInfo();
        if (result == null) {
            //result = request.getServletPath();
        }
        if ((result == null) || (result.equals(""))) {
            result = "/";
        }
        return (result);
    }
410311
public String getPathWithinApplication(HttpServletRequest request) {
        String requestUri = request.getRequestURI();
        if (requestUri == null) 
        	requestUri = "";
        String decodedRequestUri = decodeRequestString(request, requestUri);
        String contextPath = "";//getContextPath(request);
        String path;
        if (StringUtils.startsWithIgnoreCase(decodedRequestUri, contextPath) && !conf.isUseContext()) {
            // Normal case: URI contains context path.
            path = decodedRequestUri.substring(contextPath.length());

        } else if (!StringUtils.startsWithIgnoreCase(decodedRequestUri, contextPath) && conf.isUseContext()) {
            // add the context path on
            path = contextPath + decodedRequestUri;

        } else {
            path = decodedRequestUri;
        }
        return StringUtils.isBlank(path) ? "/" : path;
    }
131403
function processURLSegments(parentNode, segments) {
		segments.forEach(function(segment) {
			if (segment.urlStr){
				var link = document.createElement("a"); //$NON-NLS-0$
		        link.href = segment.urlStr;
		        link.appendChild(document.createTextNode(segment.segmentStr));
		        link.dir = bidiUtils.getTextDirection(segment.segmentStr);
				parentNode.appendChild(link);
			} else {
				var plainText = document.createElement("span"); //$NON-NLS-0$
				plainText.textContent = segment.segmentStr;
				plainText.dir = bidiUtils.getTextDirection(segment.segmentStr);
				parentNode.appendChild(plainText);
			}
		});
	}
1167702
private String getURI(HttpServletRequest request)
    {
        String uri= (String)request.getAttribute("javax.servlet.forward.request_uri");
        if (uri == null)
            uri= request.getRequestURI();
        return uri;
    }