List of usage examples for java.net URL toString
public String toString()
From source file:com.cladonia.xngreditor.URLUtilities.java
public static String getFileName(URL url) { if (url != null) { return getFileName(url.toString()); } else {// w w w. ja va2 s. com return null; } }
From source file:com.cladonia.xngreditor.URLUtilities.java
public static String getFileNameWithoutExtension(URL url) { if (url != null) { return getFileName(url.toString()); } else {/*from w w w. ja v a 2 s. c o m*/ return null; } }
From source file:com.cladonia.xngreditor.URLUtilities.java
public static String getExtension(URL url) { if (url != null) { return getExtension(url.toString()); } else {/* w w w. j a va 2 s . co m*/ return null; } }
From source file:com.redhat.victims.VictimsService.java
/** * /*from www . j a v a2 s. c o m*/ * Work horse method that provides a {@link RecordStream} wraped from a * response received from the server. * * @param since * The date from when removed records are required for. * @param type * The service type. To be used as ${base-uri}/${service}/%{type} * @return * @throws IOException */ protected RecordStream fetch(Date since, String type) throws IOException { SimpleDateFormat fmt = new SimpleDateFormat(VictimsRecord.DATE_FORMAT); String spec = FileUtils.getFile(serviceEntry, type, fmt.format(since)).toString(); spec = FilenameUtils.normalize(spec, true); URL merged = new URL(new URL(baseURI), spec); return new RecordStream(merged.toString()); }
From source file:eu.trentorise.smartcampus.permissionprovider.cas.NoSSLCas20ServiceTicketValidator.java
/** * @param url//from w w w . j a v a2 s. co m * @param ticket * @return */ private String retrieveResponseFromServerNoSSL(URL url, String ticket) { try { final HttpGet get = new HttpGet(url.toString()); final HttpResponse resp = getHttpClient().execute(get); String response = EntityUtils.toString(resp.getEntity(), "UTF-8"); return response; } catch (final Exception e) { throw new RuntimeException(e); } }
From source file:com.cladonia.xngreditor.URLUtilities.java
/** * Resolve the relative location based on the base URL. * /*from ww w. j a va2 s . c o m*/ * @param url the base url. * * @return a new file or null if the URL does not describe a file. */ public static String resolveURL(URL base, String location) { String result = null; if (location != null && location.trim().length() > 0) { try { URL url = new URL(base, location); result = url.toString(); } catch (MalformedURLException e) { URL url = toURL(location); if (url != null) { result = url.toString(); } } } return result; }
From source file:dip.world.variant.VariantManager.java
/** * Gets the URL to the Variant package (plugin). This is typically * only needed in special circumstances. Returns null if null variant * input OR variant not found./*ww w . j av a 2s . c o m*/ * <p> * Note that this will always return a URL with a JAR prefix. * e.g.: <code>jar:http:/the.location/ajar.zip!/</code> * or <code>jar:file:/c:/plugins/ajar.zip!/</code> */ public static URL getVariantPackageJarURL(Variant variant) { if (variant != null) { VRec vr = getVRec(variant); if (vr != null) { assert (vr.getURL() != null); URL url = vr.getURL(); String txtUrl = url.toString(); if (txtUrl.startsWith("jar:")) { return url; } else { StringBuffer sb = new StringBuffer(txtUrl.length() + 8); sb.append("jar:"); sb.append(txtUrl); sb.append("!/"); try { return new URL(sb.toString()); } catch (MalformedURLException e) { Log.println("Could not convert ", url, " to a JAR url."); Log.println("Exception: ", e); } } } } return null; }
From source file:com.cedarsoft.serialization.serializers.jackson.UrlSerializer.java
@Override public void serialize(@Nonnull JsonGenerator serializeTo, @Nonnull URL object, @Nonnull Version formatVersion) throws IOException, JsonProcessingException { verifyVersionWritable(formatVersion); serializeTo.writeString(object.toString()); }
From source file:com.norconex.commons.lang.url.HttpURL.java
/** * Constructor. * @param url a URL */ public HttpURL(URL url) { this(url.toString()); }
From source file:net.sourceforge.mavenhippo.AbstractHippoMojo.java
protected ClassLoader getProjectClassloader() throws MojoExecutionException { try {//from w w w . j av a 2 s. c om if (projectClassloader == null) { Set<Artifact> artifacts = project.getArtifacts(); List<URL> urls = new ArrayList<URL>(); for (Artifact artifact : artifacts) { urls.add(artifact.getFile().toURI().toURL()); } if (getLog().isDebugEnabled()) { for (URL url : urls) { getLog().debug("Project dependency URL: " + url.toString()); } } projectClassloader = new URLClassLoader(urls.toArray(new URL[0]), this.getClass().getClassLoader()); } return projectClassloader; } catch (MalformedURLException e) { throw new MojoExecutionException(e.getLocalizedMessage(), e); } }