Example usage for java.net URI toString

List of usage examples for java.net URI toString

Introduction

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

Prototype

public String toString() 

Source Link

Document

Returns the content of this URI as a string.

Usage

From source file:doge.controller.UsersRestController.java

private void sendMessage(User user, URI uri) {
    Map<String, String> msg = new HashMap<>();
    msg.put("dogePhotoUri", uri.toString());
    msg.put("userId", user.getId());
    msg.put("userName", user.getName());
    msg.put("uploadDate", java.time.Clock.systemUTC().instant().toString());
    this.messaging.convertAndSend("/topic/alarms", msg);
}

From source file:org.jvoicexml.demo.mmi.simpledemo.SimpleMmiDemo.java

/**
 * Executes a session with a predefindedVoiceXML document.
 * /*from www. j  a va  2 s  .  c  om*/
 * @throws URISyntaxException
 * @throws JAXBException
 * @throws IOException
 * @throws ClientProtocolException
 */
private void call() throws URISyntaxException, JAXBException, IOException, ClientProtocolException {
    final String context = UUID.randomUUID().toString();
    int requestId = 4242;
    final Mmi mmi = new Mmi();
    final StartRequest start = new StartRequest();
    mmi.setStartRequest(start);
    final URI source = new URI("http://localhost:9092");
    start.setSource(source.toString());
    final URI target = new URI("http://localhost:9090");
    start.setTarget(target.toString());
    start.setContext(context);
    start.setRequestId(Integer.toString(requestId));
    // final File file = new File("simpleexample.vxml");
    final File file = new File("simpleexample-de.vxml");
    final URI example = file.toURI();
    start.setContentURL(example);
    send(mmi, target);
}

From source file:com.evolveum.midpoint.prism.schema.CatalogImpl.java

/**
 * This fixes catalog items. When launched as spring boot fat jar, catalog by default resolve URIs like
 * <p>//from ww w  .j a v a  2 s.c o m
 * jar:file:/SOME_ABSOLUTE_PATH/midpoint.war!/WEB-INF/lib/schema-3.7-SNAPSHOT.jar!/META-INF/../xml/ns/public/common/common-core-3.xsd
 * <p>
 * which looks at first sight, but correct working version is:
 * <p>
 * jar:file:/SOME_ABSOLUTE_PATH/midpoint.war!/WEB-INF/lib/schema-3.7-SNAPSHOT.jar!/xml/ns/public/common/common-core-3.xsd
 * <p>
 * This catalog impl is enabled only when in spring boot fat jar is launched through main() using:
 * <p>
 * System.setProperty("xml.catalog.className", CatalogImpl.class.getName());
 */
@Override
protected String makeAbsolute(String sysid) {
    String absolute = super.makeAbsolute(sysid);

    if (absolute == null) {
        return null;
    }

    String[] array = absolute.split("!/");
    if (array.length <= 1) {
        return absolute;
    }

    String[] normalized = new String[array.length];
    for (int i = 0; i < array.length; i++) {
        String part = array[i];

        URI uri = java.net.URI.create(part);
        uri = uri.normalize();

        normalized[i] = uri.toString();
    }

    String newAbsolute = StringUtils.join(normalized, "!/");

    if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("Normalized absolute path from '{}' to '{}'", absolute, newAbsolute);
    }

    return newAbsolute;
}

From source file:mjg.SongClient.java

public void addSong(String id, String title, String artist, String year) {
    String url = "http://localhost:8163/SongService/SongService.groovy";
    Song s = new Song();
    s.setId(id);/*from  w w w. j  a  v a2s.  com*/
    s.setArtist(artist);
    s.setTitle(title);
    s.setYear(year);
    Song2XML converter = new Song2XML();
    URI uri = template.postForLocation(url, converter.song2xml(s));
    if (uri != null) {
        log.info("Location: " + uri.toString());
    } else {
        log.info("No Location header found");
    }
}

From source file:net.ripe.rpki.commons.crypto.x509cert.GenericRpkiCertificateBuilder.java

protected void validateIsRsyncUri(URI crlUri) {
    Validate.isTrue(crlUri.toString().startsWith("rsync:"),
            "Rsync URI is required, multiple repositories not supported by this builder at this time");
}

From source file:net.ripe.rpki.commons.provisioning.payload.common.CertificateElement.java

public URI getRsyncAIAPointer() {
    for (URI uri : issuerCertificatePublicationLocationUris) {
        if (uri.toString().startsWith("rsync")) {
            return uri;
        }/*from w  w w  . j  a v  a 2 s.  c om*/
    }
    return null;

}

From source file:com.microsoft.azure.hdinsight.spark.jobs.JobUtils.java

public void openFileExplorer(URI uri) {
    openDefaultBrowser(uri.toString());
}

From source file:org.gradle.internal.resource.transport.http.HttpResourceAccessor.java

public ExternalResourceMetaData getMetaData(URI uri) {
    abortOpenResources();//from  w  ww.j  a  v a2s  .  c om
    String location = uri.toString();
    LOGGER.debug("Constructing external resource metadata: {}", location);
    HttpResponse response = http.performHead(location);
    return response == null ? null : new HttpResponseResource("HEAD", uri, response).getMetaData();
}

From source file:de.sones.mule.demo.transformers.GQLToHttpRequestTransformer.java

@Override
public Object transformMessage(MuleMessage message, String arg1) throws TransformerException {

    try {/*from   w  w w  .j  a va 2s. com*/

        HttpMethod result;

        //Get the contents of the previous message
        Object src = message.getPayload();

        System.out.println("Body:" + src.toString());

        //Get the endpoint which is configured
        String endpoint = message.getOutboundProperty(MuleProperties.MULE_ENDPOINT_PROPERTY, null);

        System.out.println("Enpoint:" + endpoint);

        //Create an uri
        URI uri = null;

        uri = new URI(endpoint);

        PostMethod postMethod = new PostMethod(uri.toString());

        InputStream is = new ByteArrayInputStream(src.toString().getBytes("UTF-8"));

        postMethod.setRequestBody(src.toString());

        result = postMethod;

        return result;

    } catch (Exception e) {
        throw new TransformerException(this, e);
    }

}

From source file:com.skcraft.launcher.install.InstallLog.java

private String relativize(File child) {
    checkNotNull(baseDir);/*from   w w w .  ja  v a 2  s  . co  m*/
    URI uri = child.toURI();
    String relative = baseDir.toURI().relativize(uri).getPath();
    if (relative.equals(uri.toString())) {
        throw new IllegalArgumentException("Child path not in base");
    }
    return relative;
}