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.projecthdata.social.api.connect.HDataServiceProvider.java

/**
 * @param clientId//from ww  w.ja  v  a 2s.co  m
 * @param clientSecret
 * @param ehrUrl
 *            - the URL to an electronic health record
 */
public HDataServiceProvider(String clientId, String clientSecret, String ehrUrl) {
    // TODO: agree on a way to dynamically determine these URLs from the ehr
    // super(new OAuth2Template(clientId, clientSecret,
    // getAuthorizeUrl(ehrUrl), getAccessTokenUrl(ehrUrl)));

    super(new HDataOAuth2Template(clientId, clientSecret, HDataServiceProvider.getAuthorizeUrl(ehrUrl),
            getAccessTokenUrl(ehrUrl)));
    this.ehrUrl = URI.create(ehrUrl);
}

From source file:net.javacrumbs.restfire.httpcomponents.HttpComponentsRequestBuilderTest.java

@Test
public void testToAllInclusive() throws URISyntaxException {
    requestBuilder.to("https://bob:bobby@www.lunatech.com:8080/file;p=1?q=2#third");

    assertEquals(URI.create("https://bob:bobby@www.lunatech.com:8080/file;p=1?q=2#third"),
            requestBuilder.getUriBuilder().build());
}

From source file:net.sf.taverna.t2.activities.localworker.LocalworkerActivityFactory.java

@Override
public URI getActivityType() {
    return URI.create(LocalworkerActivity.URI);
}

From source file:org.wrml.runtime.rest.RestUtils.java

public static final URI encodeUri(final URI uri) {

    String uriString;/*from w  ww. ja v  a  2s  .  c  om*/
    try {
        uriString = URLEncoder.encode(uri.toString(), DEFAULT_ENCODING);
    } catch (final UnsupportedEncodingException e) {
        return null;
    }

    return URI.create(uriString);
}

From source file:net.benmoran.affectsampler.Synchronizer.java

private URI getCreateSampleUri() {
    return URI.create("/Sample/");
}

From source file:lumbermill.aws.kcl.internal.KinesisConsumerBootstrap.java

public KinesisConsumerBootstrap(KinesisClientLibConfiguration kinesisCfg, UnitOfWorkListener unitOfWorkListener,
        ExceptionStrategy exceptionStrategy, Metrics metricsCallback, boolean dry) {
    this.kinesisCfg = kinesisCfg;
    this.unitOfWorkListener = unitOfWorkListener;
    this.exceptionStrategy = exceptionStrategy;
    this.metricsCallback = metricsCallback;
    this.dry = dry;
    String httpsProxy = System.getenv("https_proxy");
    if (StringUtils.isNotEmpty(httpsProxy)) {
        URI proxy = URI.create(httpsProxy);
        kinesisCfg.getKinesisClientConfiguration().setProxyHost(proxy.getHost());
        kinesisCfg.getKinesisClientConfiguration().setProxyPort(proxy.getPort());
        kinesisCfg.getDynamoDBClientConfiguration().setProxyHost(proxy.getHost());
        kinesisCfg.getDynamoDBClientConfiguration().setProxyPort(proxy.getPort());
        kinesisCfg.getCloudWatchClientConfiguration().setProxyHost(proxy.getHost());
        kinesisCfg.getCloudWatchClientConfiguration().setProxyPort(proxy.getPort());
    }/*ww  w  .j  a v a 2 s . co m*/
}

From source file:co.cask.cdap.passport.http.client.PassportClient.java

public PassportClient() {
    this(URI.create("http://localhost"));
}

From source file:com.orange.spring.cloud.connector.s3.heroku.S3ServiceInfoCreator.java

public S3ServiceInfo createServiceInfo(S3DetectableService s3DetectableService) {
    Map<String, String> env = environment.getEnv();
    String accessKeyId = env.get(s3DetectableService.getAccessKeyIdEnvKey());
    String secretAccessKey = env.get(s3DetectableService.getSecretAccessKeyEnvKey());
    String bucketName = env.get(s3DetectableService.getBucketNameEnvKey());
    String finalUrl = this.getFinalUrl(s3DetectableService, bucketName);
    URI finalUri = URI.create(finalUrl);
    return new S3ServiceInfo(bucketName, finalUri.getScheme(), finalUri.getHost(), finalUri.getPort(),
            accessKeyId, secretAccessKey, finalUri.getPath());
}

From source file:org.ale.scanner.zotero.web.googlebooks.GoogleBooksAPIClient.java

public void isbnLookup(String isbn) {
    APIRequest r = newRequest();/*ww w  . j a va  2s.c o  m*/
    r.setHttpMethod(APIRequest.GET);
    r.setURI(URI.create(BOOK_SEARCH_ISBN + isbn));
    Bundle extra = new Bundle();
    extra.putString(GoogleBooksAPIClient.EXTRA_ISBN, isbn);
    r.setExtra(extra);

    mRequestQueue.enqueue(r);
}

From source file:com.flicklib.service.cache.HttpCache4J.java

/** {@inheritDoc} */
@Override/*  w  w  w .  j av a 2 s .  c  o  m*/
public Source loadSource(final String url, boolean useCache) {
    HTTPRequest request = new HTTPRequest(URI.create(url));
    HTTPResponse response = cache.execute(request, !useCache);
    String content = payloadToString(response);
    String respUrl = response.getHeaders().getFirstHeaderValue("Content-Location");
    //System.err.println(response.getHeaders().toString());
    final String theUrl = respUrl != null ? respUrl : url;
    Source source = new Source(theUrl, content, response.getPayload().getMimeType().toString(), url);
    return source;
}