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:de.otto.jsonhome.generator.SpringJsonHomeGenerator.java

@Value("${jsonhome.applicationBaseUri}")
public void setApplicationBaseUri(final String applicationBaseUri) {
    this.applicationBaseUri = URI.create(applicationBaseUri);
}

From source file:org.wso2.msf4j.spring.SpringHttpServerTest.java

@BeforeClass
public void setup() throws Exception {
    baseURI = URI.create(String.format("http://%s:%d", Constants.HOSTNAME, port));
    MSF4JSpringApplication msf4JSpringApplication = new MSF4JSpringApplication(SpringHttpServerTest.class);
    configurableApplicationContexts.add(msf4JSpringApplication.run(true, "--http.port=8090"));
    configurableApplicationContexts.add(MSF4JSpringApplication.run(SecondService.class, "--http.port=8091"));
    msf4JSpringApplication.addService(configurableApplicationContexts.get(1),
            TestMicroServiceWithDynamicPath.class, "/DynamicPath");
    msf4JSpringApplication.addService(configurableApplicationContexts.get(1),
            TestMicroServiceWithDynamicPath.class, "/DynamicPath2");
}

From source file:com.seajas.search.bridge.contender.metadata.URIReadConverter.java

/**
 * {@inheritDoc}
 */
@Override
public URI convert(final String source) {
    return URI.create(source);
}

From source file:org.biopax.validator.rules.BiopaxElementIdRule.java

public void check(final Validation validation, BioPAXElement thing) {
    String rdfid = thing.getUri();
    if (rdfid != null) {
        try {/* www. j av a  2  s  .c o  m*/
            URI.create(rdfid);
        } catch (IllegalArgumentException e) {
            error(validation, thing, "invalid.rdf.id", false, "not a valid URI: " + rdfid);
        }
    } else
        error(validation, thing, "invalid.rdf.id", false, "null value");
}

From source file:com.google.mr4c.config.site.MR4CSite.java

private static URI findSiteConf() {
    String file = MR4CConfig.getDefaultInstance().getCategory(Category.CORE)
            .getProperty(CoreConfig.PROP_SITE_CONF);
    if (StringUtils.isEmpty(file)) {
        file = DEFAULT_SITE_FILE;/*from   w w  w  .  j a va 2  s.  c o m*/
    }
    return URI.create(file);
}

From source file:com.almende.eve.test.TestZmq.java

/**
 * Gets the url.//from ww w  .j a v  a2s  . c  o  m
 * 
 * @param type
 *            the type
 * @param agentId
 *            the agent id
 * @return the url
 */
private URI getUrl(final String type, final String agentId) {
    if ("tcp".equals(type)) {
        final int port = agentId.equals("test") ? 5556 : 5557;
        return URI.create("zmq:tcp://127.0.0.1:" + port);
    } else if ("inproc".equals(type)) {
        return URI.create("zmq:inproc://" + agentId);
    } else if ("ipc".equals(type)) {
        return URI.create("zmq:ipc:///tmp/" + agentId);
    }
    return null;
}

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

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

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

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

    URI brokenHttpUri = URI.create("http://json-schema.org/address123123213");
    resolver.resolve(brokenHttpUri);/*from   w  w w  . ja v a  2  s .c o  m*/
}

From source file:eu.unifiedviews.plugins.transformer.gzipper.GzipperTest.java

@Test
public void execute() throws Exception {
    GzipperConfig_V1 config = new GzipperConfig_V1();

    // Prepare DPU.
    Gzipper dpu = new Gzipper();
    dpu.configure((new ConfigurationBuilder()).setDpuConfiguration(config).toString());

    // Prepare test environment.
    TestEnvironment environment = new TestEnvironment();

    // Prepare data unit.
    WritableFilesDataUnit filesOutput = environment.createFilesOutput("filesOutput");
    WritableFilesDataUnit filesInput = environment.createFilesInput("filesInput");

    File inputFile = new File(URI.create(filesInput.addNewFile("LICENSE")));
    try (FileOutputStream fout = new FileOutputStream(inputFile)) {
        IOUtils.copy(Thread.currentThread().getContextClassLoader().getResourceAsStream("LICENSE"), fout);
    }//from   www . j av  a 2 s  .  co  m
    try {
        // Run.
        environment.run(dpu);

        // Get file iterator.
        Set<FilesDataUnit.Entry> outputFiles = FilesHelper.getFiles(filesOutput);
        Assert.assertEquals(1, outputFiles.size());

        FilesDataUnit.Entry entry = outputFiles.iterator().next();

        byte[] outputContent = IOUtils.toByteArray(
                new GZIPInputStream(new FileInputStream(new File(new URI(entry.getFileURIString())))));
        byte[] expectedContent = IOUtils
                .toByteArray(Thread.currentThread().getContextClassLoader().getResourceAsStream("LICENSE"));

        Assert.assertArrayEquals(expectedContent, outputContent);

        Assert.assertEquals("LICENSE.gz", VirtualPathHelpers.getVirtualPath(filesOutput, "LICENSE"));
    } finally {
        // Release resources.
        environment.release();
    }
}

From source file:reconf.server.domain.result.PropertyResult.java

public PropertyResult(Property arg, String baseUrl) {
    this(arg);/* w  ww  . ja  va  2  s.c  o m*/
    this.links = new ArrayList<>();
    this.links.add(new Link(URI.create(baseUrl + getAlternateUri(arg)), "alternate"));
}