Return a new instance of {@code {@link BeadledomWebTarget}} with the given URI path by using
the default builder implementation on the classpath found using SPI.
2465
public BeadledomWebTarget buildTarget(URI baseUrl) {
    BeadledomClient beadledomClient = build();
    return beadledomClient.target(baseUrl);
  }
567733
URI buildUri(String relativePath)
    {    
        URI uri = null;
        
        try
        {    
            uri = new URI(buildUrl(relativePath));   
        }
        catch (URISyntaxException e)
        {           
            logger.severe("Problem constructing URI: "+e.getClass().getName()+e.getMessage());
        }

        return uri;
    }
1262444
public static URI getURI(String classpathOrFilePath) {
        return Optional.ofNullable(getResourceURI(classpathOrFilePath))
                .orElseGet(() -> new File(classpathOrFilePath).toURI());
    }
378733
@Override
    public T addAsWebResource(File resource, String target) throws IllegalArgumentException {
        Validate.notNull(resource, "Resource should be specified");
        Validate.notNull(target, "Target should be specified");

        return addAsWebResource(new FileAsset(resource), target);
    }
179555
public static Resource getResourceObj(String path) {
		if(StrUtil.isNotBlank(path)) {
			if(path.startsWith(URLUtil.FILE_URL_PREFIX) || FileUtil.isAbsolutePath(path)) {
				return new FileResource(path);
			}
		}
		return new ClassPathResource(path);
	}
612401
public static String getAbsolutePath(String path, Class<?> baseClass) {
		String normalPath;
		if (path == null) {
			normalPath = StrUtil.EMPTY;
		} else {
			normalPath = normalize(path);
			if (isAbsolutePath(normalPath)) {
				// 给定的路径已经是绝对路径了
				return normalPath;
			}
		}

		// 相对于ClassPath路径
		final URL url = ResourceUtil.getResource(normalPath, baseClass);
		if (null != url) {
			// 对于jar中文件包含file:前缀，需要去掉此类前缀，在此做标准化，since 3.0.8 解决中文或空格路径被编码的问题
			return FileUtil.normalize(URLUtil.getDecodedPath(url));
		}

		// 如果资源不存在，则返回一个拼接的资源绝对路径
		final String classPath = ClassUtil.getClassPath();
		if (null == classPath) {
			// throw new NullPointerException("ClassPath is null !");
			// 在jar运行模式中，ClassPath有可能获取不到，此时返回原始相对路径（此时获取的文件为相对工作目录）
			return path;
		}

		// 资源不存在的情况下使用标准化路径有问题，使用原始路径拼接后标准化路径
		return normalize(classPath.concat(path));
	}
915231
private Resource newResource(final String resourcePath) {
        return new Resource(this, /* length unknown */ -1L) {
            /** The module reader proxy. */
            private ModuleReaderProxy moduleReaderProxy;

            @Override
            public String getPath() {
                return resourcePath;
            }

            @Override
            public String getPathRelativeToClasspathElement() {
                return resourcePath;
            }

            @Override
            public synchronized ByteBuffer read() throws IOException {
                if (skipClasspathElement) {
                    // Shouldn't happen
                    throw new IOException("Module could not be opened");
                }
                markAsOpen();
                try {
                    moduleReaderProxy = moduleReaderProxyRecycler.acquire();
                    // ModuleReader#read(String name) internally calls:
                    // InputStream is = open(name); return ByteBuffer.wrap(is.readAllBytes());
                    byteBuffer = moduleReaderProxy.read(resourcePath);
                    length = byteBuffer.remaining();
                    return byteBuffer;

                } catch (final SecurityException | OutOfMemoryError e) {
                    close();
                    throw new IOException("Could not open " + this, e);
                }
            }

            @Override
            synchronized InputStreamOrByteBufferAdapter openOrRead() throws IOException {
                return new InputStreamOrByteBufferAdapter(open());
            }

            @Override
            public synchronized InputStream open() throws IOException {
                if (skipClasspathElement) {
                    // Shouldn't happen
                    throw new IOException("Module could not be opened");
                }
                markAsOpen();
                try {
                    moduleReaderProxy = moduleReaderProxyRecycler.acquire();
                    inputStream = new InputStreamResourceCloser(this, moduleReaderProxy.open(resourcePath));
                    // Length cannot be obtained from ModuleReader
                    length = -1L;
                    return inputStream;

                } catch (final SecurityException e) {
                    close();
                    throw new IOException("Could not open " + this, e);
                }
            }

            @Override
            public synchronized byte[] load() throws IOException {
                try {
                    read();
                    final byte[] byteArray = byteBufferToByteArray();
                    length = byteArray.length;
                    return byteArray;
                } finally {
                    close();
                }
            }

            @Override
            public synchronized void close() {
                super.close(); // Close inputStream
                if (byteBuffer != null) {
                    if (moduleReaderProxy != null) {
                        // Release any open ByteBuffer
                        moduleReaderProxy.release(byteBuffer);
                    }
                    byteBuffer = null;
                }
                if (moduleReaderProxy != null) {
                    // Recycle the (open) ModuleReaderProxy instance.
                    moduleReaderProxyRecycler.recycle(moduleReaderProxy);
                    // Don't call ModuleReaderProxy#close(), leave the ModuleReaderProxy open in the recycler.
                    // Just set the ref to null here. The ModuleReaderProxy will be closed by
                    // ClasspathElementModule#close().
                    moduleReaderProxy = null;
                }
                markAsClosed();
            }
        };
    }
1020838
public static UriBuilder fromUri(Uri uri) throws IllegalArgumentException {
        if (uri == null)
            throw new IllegalArgumentException("Uri cannot be null");

        UriBuilder b = newInstance();
        b.uri(uri);
        return b;
    }
308826
URLClassLoader createUrlClassLoader(
            final List<String> classpathElements,
            final ClassLoader contextClassLoader)
            throws MojoExecutionException {
        try {
            final URL[] urls = new URL[classpathElements.size()];
            int i = 0;
            for (final String classpathElement : classpathElements) {
                urls[i++] = new File(classpathElement).toURI().toURL();
            }
            return URLClassLoader.newInstance(urls, contextClassLoader);
        } catch (final MalformedURLException e) {
            throw new MojoExecutionException("Unable to instantiate class loader", e);
        }
    }
702653
public static Proto loadFromClasspath(String path, Proto importer) throws Exception
    {
        URL resource = getResource(path, DefaultProtoLoader.class);
        if (resource == null)
            return null;

        Proto proto = new Proto(resource, DEFAULT_INSTANCE, importer);
        ProtoUtil.loadFrom(resource, proto);
        return proto;
    }
1100772
public URI addAPIKey(String uri) {
        try {
            final URIBuilder builder = new URIBuilder(uri);
            if (apiAccessKey != null) {
                builder.setParameter("key", apiAccessKey);
            }
            return builder.build();
        } catch (URISyntaxException e) {
            throw new RedmineInternalError(e);
        }
    }
399417
protected URI buildUri(final String path, final List<NameValuePair> queryStringParams) {
        final StringBuilder sb = new StringBuilder();
        
        sb.append(path);
        if (queryStringParams != null && queryStringParams.size() > 0) {
            sb.append("?").append(URLEncodedUtils.format(queryStringParams, "UTF-8"));
        }

        try {
            return new URI(sb.toString());
        } catch (final URISyntaxException e) {
            throw new IllegalStateException("Invalid uri", e);
        }
    }
828644
public WritableByteChannel create(URI path) throws IOException {
    logger.atFine().log("create(%s)", path);
    return create(path, CreateFileOptions.DEFAULT);
  }
1337012
def _url_builder(url_root,api_key,path,params):
    
    params['api_key'] = api_key
    url_end = urlencode(params)
    url = "%s%s%s" % (url_root,path,url_end)
    return url
264778
private WebTarget createWebTarget(String restPath, Map<String, String> queryParams) {
		WebTarget webTarget;
		try {
			URI u = new URI(this.baseURI + "/plugins/restapi/v1/" + restPath);
			Client client = createRestClient();

			webTarget = client.target(u);
			if (queryParams != null && !queryParams.isEmpty()) {
				for (Map.Entry<String, String> entry : queryParams.entrySet()) {
					if (entry.getKey() != null && entry.getValue() != null) {
						LOG.debug("PARAM: {} = {}", entry.getKey(), entry.getValue());
						webTarget = webTarget.queryParam(entry.getKey(), entry.getValue());
					}
				}
			}

		} catch (Exception e) {
			throw new IllegalArgumentException("Something went wrong by creating the client: " + e);
		}

		return webTarget;
	}
562832
public UriBuilder path(String path) throws URISyntaxException {
        path = path.trim();
        if (getPath().endsWith("/")) {
            return new UriBuilder(setPath(String.format("%s%s", getPath(), path)));
        } else {
            return new UriBuilder(setPath(String.format("%s/%s", getPath(), path)));
        }
    }
130696
public URI build() {
    try {
      return new URI((isView ? VIEW_SCHEME : DATASET_SCHEME) + ":" +
          pattern.construct(options).toString());
    } catch (URISyntaxException e) {
      throw new IllegalArgumentException("Could not build URI", e);
    }
  }