List of usage examples for java.net URL toString
public String toString()
From source file:org.apache.bigtop.bigpetstore.qstream.HttpLoadGen.java
public HttpLoadGen(int nStores, int nCustomers, double simulationLength, long seed, URL u) throws Throwable { super(nStores, nCustomers, simulationLength, seed); path = u.toString(); }
From source file:javazoom.jlgui.player.amp.tag.MpegInfoApplet.java
/** * Load MP3 info from URL./*from w w w .j a v a 2 s . c o m*/ * @param input * @throws IOException * @throws UnsupportedAudioFileException */ protected void loadInfo(URL input) throws IOException, UnsupportedAudioFileException { log.debug("loadInfo for MP3 : " + input.toString()); AudioFileFormat aff = AppletMpegSPIWorkaround.getAudioFileFormat(input); super.loadInfo(aff); super.loadShoutastInfo(aff); }
From source file:client.lib.Client.java
public int test(String url) throws IOException, MalformedURLException { int successful = 0; URL entry = new URL(url); Request request = new Request.Builder().url(entry.toString()).build(); Response response = httpClient.newCall(request).execute(); System.out.println(response.protocol()); try {/*from w ww . ja v a 2 s . co m*/ JSONObject json = new JSONObject(response.body().string()); JSONArray urls = json.getJSONArray("urls"); for (int i = 0; i < urls.length(); ++i) { response = request(http2Client, new URL(urls.getString(i))); if (response != null) { successful++; } } URL finish = new URL(entry.getProtocol(), entry.getHost(), entry.getPort(), json.getString("finish")); request(httpClient, finish); } catch (JSONException e) { System.out.println(e.getMessage()); } return successful; }
From source file:com.jejking.hh.nord.corpus.DrucksachenHtmlFetcher.java
private String fileNameFromUrl(URL url) { return Hex.encodeHexString(url.toString().getBytes(Charsets.UTF_8)); }
From source file:dk.sublife.docker.integration.ContainerRestAdapter.java
/** * Check if rest service is up and return response. * * @param url of the service to call/* w w w.j a v a2 s. c om*/ * @return response * @throws Exception */ protected String isUp(URL url) throws Exception { final RestTemplate restTemplate = new RestTemplate(); return restTemplate.getForObject(url.toString(), String.class); }
From source file:org.cagrid.gaards.websso.utils.FileHelper.java
public File getFile(String fileName) throws AuthenticationConfigurationException { URL url = getFileAsURL(fileName); URI uri;//from www. ja v a2s . co m try { uri = new URI(url.toString()); } catch (URISyntaxException e) { throw new AuthenticationConfigurationException("Error obtaining the URI for the " + fileName + " file"); } return new File(uri); }
From source file:com.blackducksoftware.integration.eclipseplugin.common.services.DependencyInformationServiceTest.java
@Test public void testIsMavenDependency() { PowerMockito.mockStatic(JavaCore.class); Mockito.when(JavaCore.getClasspathVariable(ClasspathVariables.MAVEN)).thenReturn(mavenPath); Mockito.when(mavenPath.toString()).thenReturn(getSystemSpecificFilepath(fakeMavenClasspathVariable, "/")); for (final URL dependency : MAVEN_DEPENDENCIES_TO_TEST) { assertTrue(dependency.toString() + " is not a maven dependency", service.isMavenDependency(dependency)); }/*ww w. j a v a 2 s . c o m*/ }
From source file:nz.co.senanque.madura.configuration.ConfigSetupTest.java
@Test public void testSpringConfig() throws Exception { ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext( getConfigLocations());// w ww.java 2 s .co m Object hs1 = applicationContext.getBean("component.sourcedir"); assertTrue("mysourcedir".equals(hs1.toString())); Object hs2 = applicationContext.getBean("component1.sourcedir"); System.out.println(hs2.toString()); assertTrue("mysourcedir".equals(hs2.toString())); URL url = (URL) applicationContext.getBean("myurl"); assertTrue("http://localhost:8080/jjj".equals(url.toString())); System.out.println(url.toString()); Configuration configuration = (Configuration) applicationContext.getBean("configuration"); Object doc = applicationContext.getBean("test1"); MyTestBean myTestBean = (MyTestBean) applicationContext.getBean("test2"); assertTrue(myTestBean.getA().equals("XYZ")); myTestBean.setA("12345"); assertTrue(myTestBean.getA().equals("12345")); List sampleList = (List) applicationContext.getBean("sampleList"); assertEquals(2, sampleList.size()); applicationContext.refresh(); // ManagedReloadingStrategy reloadingStrategy = (ManagedReloadingStrategy)applicationContext.getBean("reloadingStrategy"); // reloadingStrategy.refresh(); MyTestBean myTestBean1 = (MyTestBean) applicationContext.getBean("test2"); assertTrue(myTestBean1.getA().equals("XYZ")); }
From source file:javazoom.jlgui.player.amp.tag.OggVorbisInfoApplet.java
/** * Load Ogg Vorbis info from URL.//from w ww .j av a 2 s .c o m * @param input * @throws IOException * @throws UnsupportedAudioFileException */ protected void loadInfo(URL input) throws IOException, UnsupportedAudioFileException { log.debug("loadInfo for Ogg Vorbis : " + input.toString()); AudioFileFormat aff = AppletVorbisSPIWorkaround.getAudioFileFormat(input); super.loadInfo(aff); super.loadExtendedInfo(aff); }
From source file:ninja.eivind.hotsreplayuploader.Client.java
@Override public void start(final Stage primaryStage) throws Exception { try {//from ww w.ja v a2 s . c o m final URL logo = platformService.getLogoUrl(); final Image image = new Image(logo.toString()); primaryStage.getIcons().add(image); primaryStage.setResizable(false); addToTray(primaryStage); platformService.setupWindowBehaviour(primaryStage); // Set window title final String windowTitle = Constants.APPLICATION_NAME + " v" + releaseManager.getCurrentVersion(); primaryStage.setTitle(windowTitle); Scene scene = sceneBuilderFactory.builder() .setLocation("/ninja/eivind/hotsreplayuploader/window/Home.fxml").build(); primaryStage.setScene(scene); primaryStage.show(); } catch (Exception e) { LOG.error("Failed to start", e); throw e; } }