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:eu.asterics.mw.services.ResourceRegistry.java

/**
 * Returns a File object representing the given URI if possible.
 * This only works if the given URI is a relative path or is a path with a file scheme (starting with: file)
 * @param uri//ww w  . j  ava  2  s . c  om
 * @return
 * @throws URISyntaxException 
 */
public static File toFile(URI uri) throws URISyntaxException {
    String scheme = uri.getScheme();
    if (scheme != null && !scheme.startsWith("file")) {
        throw new URISyntaxException(uri.toString(), "The uri does not start with the scheme <file>");
    }
    File f = new File(uri.getPath());
    return f;
}

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

private URI removeFragment(URI id) {
    return URI.create(substringBefore(id.toString(), "#"));
}

From source file:com.google.mr4c.testingv2.AlgorithmTestBase.java

private String toFileList(URI... uris) {
    List<String> files = new ArrayList<String>();
    for (URI uri : uris) {
        files.add(uri.toString());
    }/*from   w  w  w .java2s.  c om*/
    return StringUtils.join(files, ",");
}

From source file:org.wso2.carbon.bpel.core.ode.integration.utils.AxisServiceUtils.java

private static WSDL11ToAxisServiceBuilder createAxisServiceBuilder(BPELProcessProxy processProxy)
        throws AxisFault {
    Definition wsdlDef = processProxy.getWsdlDefinition();
    QName serviceName = processProxy.getServiceName();
    String portName = processProxy.getPort();
    ProcessConf pConf = processProxy.getProcessConfiguration();
    QName pid = pConf.getProcessId();
    InputStream wsdlInStream = null;

    URI wsdlBaseURI = pConf.getBaseURI().resolve(wsdlDef.getDocumentBaseURI());
    try {/*from www  . j av a 2s .c o m*/
        wsdlInStream = wsdlBaseURI.toURL().openStream();
    } catch (MalformedURLException e) {
        String errMsg = "Malformed WSDL base URI.";
        handleException(pid, errMsg, e);
    } catch (IOException e) {
        String errMsg = "Error opening stream.";
        handleException(pid, errMsg, e);
    }
    WSDL11ToAxisServiceBuilder serviceBuilder = new WSDL11ToAxisPatchedBuilder(wsdlInStream, serviceName,
            portName);
    serviceBuilder.setBaseUri(wsdlBaseURI.toString());
    serviceBuilder.setCustomResolver(new Axis2UriResolver());
    try {
        serviceBuilder.setCustomWSDLResolver(new Axis2WSDLLocator(wsdlBaseURI));
    } catch (URISyntaxException e) {
        String errorMessage = "URI syntax invalid.";
        handleException(pid, errorMessage, e);
    }
    serviceBuilder.setServerSide(true);

    return serviceBuilder;
}

From source file:com.spotify.docker.client.UnixConnectionSocketFactory.java

public UnixConnectionSocketFactory(final URI socketUri) {
    super();//from ww  w.  j  a va 2  s  .  co  m

    final String filename = socketUri.toString().replaceAll("^unix:///", "unix://localhost/")
            .replaceAll("^unix://localhost", "");

    this.socketFile = new File(filename);
}

From source file:se.vgregion.pubsub.push.impl.DefaultPolledPublisher.java

@Override
public void setUrl(URI url) {
    this.url = url.toString();
}

From source file:jfs.sync.util.WindowsProxySelector.java

@Override
public List<Proxy> select(URI uri) {
    List<Proxy> result = null;

    URI url = URI.create(uri.toString().replace("https://", "http://"));
    result = root.select(url);// w w  w  .java  2  s .c o  m
    if (LOG.isDebugEnabled()) {
        LOG.debug("select() uri " + uri);
        LOG.debug("select() url " + url);
        LOG.debug("select() proxies " + result);
    } // if
    return result;
}

From source file:com.universalimageloader1.core.download.HttpClientImageDownloader.java

@Override
protected InputStream getStreamFromNetwork(URI imageUri, Object extra) {
    try {/*from www . ja v a  2 s .c o m*/
        HttpGet httpRequest = new HttpGet(imageUri.toString());
        HttpResponse response = httpClient.execute(httpRequest);
        HttpEntity entity = response.getEntity();
        BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity);
        return bufHttpEntity.getContent();
    } catch (Exception e) {
        // TODO: handle exception
        return null;

    }
}

From source file:org.jsonschema2pojo.SchemaStore.java

protected URI removeFragment(URI id) {
    return URI.create(substringBefore(id.toString(), "#"));
}

From source file:sample.web.thymeleaf3.SampleWebThymeleaf3ApplicationTests.java

@Test
public void testCreate() throws Exception {
    MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
    map.set("text", "FOO text");
    map.set("summary", "FOO");
    URI location = this.restTemplate.postForLocation("/", map);
    assertThat(location.toString()).contains("localhost:" + this.port);
}