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.github.restdriver.serverdriver.http.request.HttpDeleteWithEntity.java

/**
 * Creates a new instance of this request.
 * //from w  w  w .ja  v  a2s . c  o  m
 * @param uri The URI this request will be made to.
 */
public HttpDeleteWithEntity(String uri) {
    super();
    setURI(URI.create(uri));
}

From source file:com.nesscomputing.config.util.ClasspathConfigStrategy.java

public ClasspathConfigStrategy() {
    this(URI.create("classpath:/config"));
}

From source file:com.akamai.edgegrid.signer.restassured.RestAssuredEdgeGridRequestSigner.java

private static boolean isRelativeUrl(String uri) {
    return !URI.create(uri).isAbsolute();
}

From source file:com.facebook.presto.jdbc.client.QueryResultsTest.java

@Test
public void testRoundtrip() throws IOException {
    String id = "20150320_083317_00000_z792e";
    String infoUri = "http://127.0.0.1:52391/v1/query/20150320_083317_00000_z792e";
    String nextUri = "http://127.0.0.1:52391/v1/statement/20150320_083317_00000_z792e/1";
    ObjectMapper mapper = new ObjectMapper();
    QueryResults expected = new QueryResults(id, URI.create(infoUri), null, URI.create(nextUri), null, null,
            new StatementStats("QUEUED", false, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, null), null, null, null);

    String json = mapper.writeValueAsString(expected);
    QueryResults actual = mapper.readValue(json, QueryResults.class);

    assertEquals(actual.getId(), expected.getId());
    assertEquals(actual.getInfoUri(), expected.getInfoUri());
    assertEquals(actual.getNextUri(), expected.getNextUri());
    assertEquals(actual.getStats().toString(), expected.getStats().toString());
}

From source file:org.intermine.app.net.request.GetRequest.java

protected byte[] loadBytes(String uriString, Map<String, ?> params) {
    RestTemplate rtp = getRestTemplate();
    HttpHeaders headers = getHeaders();/*w w w.  j  av  a  2s  .c  o  m*/

    HttpEntity<String> req = new HttpEntity<>(headers);
    ResponseEntity<byte[]> res;

    URI uri = URI.create(expandQuery(uriString, params));
    res = rtp.exchange(uri, GET, req, byte[].class);
    return res.getBody();
}

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

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

From source file:com.grummages.app.rest.service.UsersRESTFacade.java

@POST
@Consumes({ "application/json" })
@Transactional/*  w  w  w .  j  a va  2 s.  c o  m*/
public Response create(Users entity) {
    entityManager.persist(entity);
    return Response.created(URI.create(entity.getUsername().toString())).build();
}

From source file:com.googlecode.jsonschema2pojo.ContentResolverTest.java

@Test(expected = IllegalArgumentException.class)
public void wrongProtocolCausesIllegalArgumentException() {

    URI uriWithUnrecognisedProtocol = URI.create("foobar://schema/address.json");
    resolver.resolve(uriWithUnrecognisedProtocol);
}

From source file:com.grummages.app.rest.service.AddressRESTFacade.java

@POST
@Consumes({ "application/json" })
@Transactional//from w ww .jav a 2 s  .  c om
public Response create(Address entity) {
    entityManager.persist(entity);
    return Response.created(URI.create(entity.getAddressId().toString())).build();
}

From source file:com.collective.celos.ci.deploy.JScpWorkerTest.java

@Test
public void getURIRespectingUsernameChanges() throws FileSystemException, URISyntaxException {
    JScpWorker worker = new JScpWorker("uname");

    URI uri = worker.getURIRespectingUsername(URI.create("sftp://server/path1/path2"));
    Assert.assertEquals(uri, URI.create("sftp://uname@server/path1/path2"));
}