Example usage for java.net URI create

List of usage examples for java.net URI create

Introduction

In this page you can find the example usage for java.net URI create.

Prototype

public static URI create(String str) 

Source Link

Document

Creates a URI by parsing the given string.

Usage

From source file:org.olat.core.commons.services.webdav.HttpPropPatch.java

/**
 * @throws IllegalArgumentException if the uri is invalid.
 */
public HttpPropPatch(final String uri) {
    super();
    setURI(URI.create(uri));
}

From source file:net.ychron.unirestinst.http.HttpPatchWithBody.java

public HttpPatchWithBody(final String uri) {
    super();
    setURI(URI.create(uri));
}

From source file:info.evanchik.eclipse.karaf.core.features.Repository.java

/**
 *
 * @return
 */
public URI toURI() {
    return URI.create(repositoryUrl);
}

From source file:com.jeffy.hdfs.HDFSReadFile.java

/**
 * HadoopFileSystem API??/*w w  w .  j a v a  2  s  .  c o  m*/
 * 
 * @param path
 * @throws IOException 
 */
public static void readDataUseFileSystem(String path) throws IOException {

    Configuration config = new Configuration();
    /**
     * ?FileSystem????????
     *  public static FileSystem get(Configuration conf) throws IOException
     *   public static FileSystem get(URI uri, Configuration conf) throws IOException
     *   public static FileSystem get(URI uri, Configuration conf, String user)
     *   throws IOException
     */
    FileSystem fs = FileSystem.get(URI.create(path), config);
    //??FSDataInputStream,DataInputStream,????
    //open4KB
    try (InputStream in = fs.open(new Path(path))) {
        IOUtils.copy(in, System.out);
    }
}

From source file:org.fcrepo.client.utils.HttpCopy.java

/**
 * Create an HTTP COPY request.//from   ww w .j  av a 2  s .c  om
 * 
 * @param source
 *            Source String URL.
 * @param destination
 *            Destination String URL.
 **/
public HttpCopy(final String source, final String destination) {
    this(URI.create(source), URI.create(destination));
}

From source file:org.springframework.cloud.dataflow.rest.util.HttpClientConfigurerTests.java

/**
 * Basic test ensuring that the {@link HttpClient} is built successfully.
 *//*from  ww w .j  a  v a 2  s  .co  m*/
@Test
public void testThatHttpClientWithProxyIsCreated() throws Exception {

    final URI targetHost = new URI("http://test.com");
    final HttpClientConfigurer builder = HttpClientConfigurer.create(targetHost);
    builder.withProxyCredentials(URI.create("https://spring.io"), "spring", "cloud");
    builder.buildHttpClient();
}

From source file:com.splunk.shuttl.server.distributed.GetRequestProvider.java

@Override
public HttpUriRequest createRequest(String shuttlHost, int shuttlPort) {
    URI endpointUri = EndpointUtils.getShuttlEndpointUri(shuttlHost, shuttlPort, endpoint);
    return new HttpGet(URI.create(
            endpointUri + "?" + EndpointUtils.createHttpGetParams("index", index, "from", from, "to", to)));
}

From source file:ch.iterate.openstack.swift.model.Region.java

public URI getStorageUrl(String container, List<NameValuePair> parameters) {
    return URI.create(
            String.format("%s?%s", this.getStorageUrl(container), URLEncodedUtils.format(parameters, "UTF-8")));
}

From source file:com.offbytwo.jenkins.model.Job.java

/**
 * Get a file from workspace.//from   w ww . j a v a  2s  .  c  o  m
 * 
 * @param fileName The name of the file to download from workspace.
 *  You can also access files which are in sub folders of the workspace.
 * @return The string which contains the content of the file.
 * @throws IOException
 */
public String getFileFromWorkspace(String fileName) throws IOException {
    InputStream is = client.getFile(URI.create(url + "/ws/" + fileName));
    ByteArrayOutputStream result = new ByteArrayOutputStream();
    byte[] buffer = new byte[1024];
    int length;
    while ((length = is.read(buffer)) != -1) {
        result.write(buffer, 0, length);
    }
    return result.toString("UTF-8");
}

From source file:com.celements.web.XWikiIncludeEventHandler.java

public String includeEvent(String includeResourcePath, String currentResourcePath, String directiveName) {
    mLogger.trace("velocity include event: [" + includeResourcePath + "], [" + currentResourcePath + "], ["
            + directiveName + "]");
    String template = URI.create("/templates/" + includeResourcePath).normalize().toString();
    if (!template.startsWith("/templates/")) {
        mLogger.warn("Illegal access, tried to use file [" + template
                + "] as a template. Possible break-in attempt!");
        return null;
    }/*ww  w  .  j  av  a2 s  . c o  m*/
    return template;
}