List of usage examples for java.net URI toString
public String toString()
From source file:com.github.sardine.impl.methods.HttpMove.java
public HttpMove(URI sourceUrl, URI destinationUrl) { this.setHeader(HttpHeaders.DESTINATION, destinationUrl.toString()); this.setHeader(HttpHeaders.OVERWRITE, "T"); this.setURI(sourceUrl); }
From source file:com.microsoft.tfs.core.util.URIUtils.java
/** * Returns a {@link URI} string for display to the user, decoding escaped * ASCII characters into Unicode. If the decoding fails (invalid escaped * characters?) the URI's toString() value is returned instead. * * @param uri//from ww w . j a v a 2 s . com * the URI to get the display string for (must not be * <code>null</code>) * @return the decoded URI string */ public static String decodeForDisplay(final URI uri) { Check.notNull(uri, "uri"); //$NON-NLS-1$ try { return URIUtil.decode(uri.toASCIIString()); } catch (final URIException e) { log.warn(MessageFormat.format("Couldn''t decode URI [{0}] display string, returning raw instead", //$NON-NLS-1$ uri.toASCIIString()), e); return uri.toString(); } }
From source file:org.hl7.fhir.client.ClientUtils.java
/** * *************************************************************** * Client connection methods// w ww . ja v a 2s .c om * ************************************************************** */ public static HttpURLConnection buildConnection(URI baseServiceUri, String tail) { try { HttpURLConnection client = (HttpURLConnection) baseServiceUri.resolve(tail).toURL().openConnection(); return client; } catch (MalformedURLException mue) { throw new EFhirClientException("Invalid Service URL", mue); } catch (IOException ioe) { throw new EFhirClientException( "Unable to establish connection to server: " + baseServiceUri.toString() + tail, ioe); } }
From source file:io.bitsquare.common.util.Utilities.java
public static void openURI(URI uri) throws IOException { if (!isLinux() && Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { Desktop.getDesktop().browse(uri); } else {/*w ww . j av a2 s. c o m*/ // Maybe Application.HostServices works in those cases? // HostServices hostServices = getHostServices(); // hostServices.showDocument(uri.toString()); // On Linux Desktop is poorly implemented. // See https://stackoverflow.com/questions/18004150/desktop-api-is-not-supported-on-the-current-platform if (!DesktopUtil.browse(uri)) throw new IOException("Failed to open URI: " + uri.toString()); } }
From source file:com.oakley.fon.util.LogRedirectHandler.java
@Override public URI getLocationURI(HttpResponse response, HttpContext context) throws ProtocolException { URI uri = super.getLocationURI(response, context); Log.d(TAG, "Redirecting to:" + uri.toString()); return uri;/*from ww w .j av a 2 s . c o m*/ }
From source file:net.ripe.rpki.commons.provisioning.serialization.CertificateUrlListConverter.java
@SuppressWarnings("unchecked") @Override/*from ww w .j av a2 s . co m*/ public String toString(Object obj) { if (obj == null) { return null; } List<String> encodedUrls = new ArrayList<String>(); for (URI uri : (List<URI>) obj) { encodedUrls.add(uri.toString().replace(",", "%2C")); } return StringUtils.join(encodedUrls, ","); }
From source file:abfab3d.shapejs.Script.java
/** * Resolve the URI down to a string./* w w w. j a va 2 s . co m*/ * @param uri * @return */ private String resolveURI(URI uri) throws IOException { if (uri.toString().startsWith("file:")) { File f = new File(uri); return FileUtils.readFileToString(f); } else { throw new IllegalArgumentException("Unsupported URI type"); } }
From source file:eu.asterics.mw.services.ResourceRegistry.java
public static Path toPath(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>"); }//from w w w . j av a 2s . c om Path p = toFile(uri).toPath(); return p; }
From source file:org.lol.reddit.reddit.api.SubredditRequestFailure.java
public SubredditRequestFailure(RequestFailureType requestFailureType, Throwable t, StatusLine statusLine, String readableMessage, URI url) { this(requestFailureType, t, statusLine, readableMessage, url != null ? url.toString() : null); }
From source file:com.collective.celos.ci.deploy.JScpWorker.java
public FileObject getFileObjectByUri(URI file) throws URISyntaxException, FileSystemException { URI uri = getURIRespectingUsername(file); return fsManager.resolveFile(uri.toString(), getSftpDefaultOptions()); }