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:com.thinkberg.vfs.s3.tests.S3FileNameTest.java

public void testGetBucketFromUri() throws FileSystemException {
    String uriString = ROOT + "/junk.txt";
    String bucketId = URI.create(uriString).getHost();
    FileName fileName = S3FileNameParser.getInstance().parseUri(null, null, uriString);
    Assert.assertEquals(bucketId, ((S3FileName) fileName).getRootFile());
}

From source file:com.netflix.iep.http.ClientConfig.java

/** Create a client config instance based on a URI. */
static ClientConfig fromUri(Configuration config, URI uri) {
    Matcher m;/*  w ww .  j  a  va  2s  .com*/
    ClientConfig cfg;
    switch (uri.getScheme()) {
    case "niws":
        m = NIWS_URI.matcher(uri.toString());
        if (m.matches()) {
            final URI newUri = URI.create(fixPath(relative(uri)));
            cfg = new ClientConfig(config, m.group(1), null, uri, newUri);
        } else {
            throw new IllegalArgumentException("invalid niws uri: " + uri);
        }
        break;
    case "vip":
        m = VIP_URI.matcher(uri.toString());
        if (m.matches()) {
            cfg = new ClientConfig(config, m.group(1), m.group(2), uri, URI.create(relative(uri)));
        } else {
            throw new IllegalArgumentException("invalid vip uri: " + uri);
        }
        break;
    default:
        cfg = new ClientConfig(config, "default", null, uri, uri);
        break;
    }
    return cfg;
}

From source file:org.whispersystems.textsecuregcm.entities.AttachmentUri.java

public URL getLocation() throws MalformedURLException {
    return URI.create(location).toURL();
}

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

/**
 * Create an HTTP MOVE request.//from www.  ja va2 s  .c  o  m
 * 
 * @param source
 *            Source String URL.
 * @param destination
 *            Destination String URL.
 **/
public HttpMove(final String source, final String destination) {
    this(URI.create(source), URI.create(destination));
}

From source file:org.exoplatform.utils.WebdavMethod.java

public WebdavMethod(String method, String sourceUriStr) {
    this.method = method;
    this.setURI(URI.create(sourceUriStr));
}

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

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

From source file:com.github.restdriver.serverdriver.http.request.HttpGetWithEntity.java

/**
 * Creates a new instance of this request.
 * //w  w  w.  j  a v  a  2  s .co m
 * @param uri The URI this request will be made to.
 */
public HttpGetWithEntity(String uri) {
    super();
    setURI(URI.create(uri));
}

From source file:com.github.restdriver.serverdriver.http.HttpMethod.java

public HttpMethod(final String method, final String uri) {
    super();/*w w w .  j a va  2s. co  m*/
    setURI(URI.create(uri));
    this.method = method.toUpperCase();
}

From source file:io.syndesis.credential.CredentialFlowStateTest.java

@Parameters(name = "{index}: {0}")
public static Iterable<Object[]> data() {
    return Arrays.asList(new Object[][] {
            { "OAUTH1",
                    new OAuth1CredentialFlowState.Builder().key("key").providerId("providerId")
                            .redirectUrl("redirectUrl").returnUrl(URI.create("return"))
                            .token(new OAuthToken("value", "secret")).verifier("verifier").build() },
            { "OAUTH2",
                    new OAuth2CredentialFlowState.Builder().key("key").providerId("providerId")
                            .redirectUrl("redirectUrl").returnUrl(URI.create("return")).code("code")
                            .state("state").build() } });
}

From source file:com.github.sardine.impl.methods.HttpCopy.java

public HttpCopy(String sourceUrl, String destinationUrl) {
    this(URI.create(sourceUrl), URI.create(destinationUrl));
}