List of usage examples for java.net URL toString
public String toString()
From source file:Main.java
@Override public void start(Stage primaryStage) { final Label markerText = new Label(); StackPane.setAlignment(markerText, Pos.TOP_CENTER); String workingDir = System.getProperty("user.dir"); final File f = new File(workingDir, "../media/omgrobots.flv"); final Media m = new Media(f.toURI().toString()); final ObservableMap<String, Duration> markers = m.getMarkers(); markers.put("Robot Finds Wall", Duration.millis(3100)); markers.put("Then Finds the Green Line", Duration.millis(5600)); markers.put("Robot Grabs Sled", Duration.millis(8000)); markers.put("And Heads for Home", Duration.millis(11500)); final MediaPlayer mp = new MediaPlayer(m); mp.setOnMarker(new EventHandler<MediaMarkerEvent>() { @Override//from ww w .j a va 2 s.com public void handle(final MediaMarkerEvent event) { Platform.runLater(new Runnable() { @Override public void run() { markerText.setText(event.getMarker().getKey()); } }); } }); final MediaView mv = new MediaView(mp); final StackPane root = new StackPane(); root.getChildren().addAll(mv, markerText); root.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { mp.seek(Duration.ZERO); markerText.setText(""); } }); final Scene scene = new Scene(root, 960, 540); final URL stylesheet = getClass().getResource("media.css"); scene.getStylesheets().add(stylesheet.toString()); primaryStage.setScene(scene); primaryStage.setTitle("Video Player 2"); primaryStage.show(); mp.play(); }
From source file:com.bist.elasticsearch.jetty.security.AuthorizationConfigurationLoader.java
public QueryConstraints load(URL url) { try {/*from ww w .java 2s . com*/ LOG.info("Loading AuthorizationMappingFile:" + url.toString()); HierarchicalINIConfiguration iniConfiguration = new HierarchicalINIConfiguration(url); QueryConstraints queryConstraints = new QueryConstraints(); return loadIni(iniConfiguration, queryConstraints); } catch (Exception e) { LOG.warn("Error while Reading File" + e.getMessage(), e); return null; } }
From source file:org.springframework.cloud.config.server.environment.HttpClientConfigurableHttpConnectionFactory.java
private String getUrlWithPlaceholders(URL url, String key) { String spec = url.toString(); String[] tokens = key.split(PLACEHOLDER_PATTERN); if (tokens.length > 1) { List<String> placeholders = getPlaceholders(key); List<String> values = getValues(spec, tokens); if (placeholders.size() == values.size()) { for (int i = 0; i < values.size(); i++) { spec = spec.replace(values.get(i), String.format("{%s}", placeholders.get(i))); }/*from w ww. j av a 2s. c o m*/ } } return spec; }
From source file:com.wavemaker.commons.io.ResourceURLTest.java
@Test public void shouldCreateRelativeToFolder() throws Exception { Folder jail = this.root.getFolder("jail").jail(); URL ab = ResourceURL.get(jail.getFolder("a/b")); URL url = new URL(ab, "c.txt"); assertThat(url.toString(), Matchers.is(Matchers.equalTo("rfs:/a/b/c.txt"))); assertThat(IOUtils.toString(url.openStream()), Matchers.is(Matchers.equalTo("c"))); }
From source file:it.pronetics.madstore.server.jaxrs.atom.search.impl.DefaultSearchDescriptionResourceHandler.java
private Url createOpenSearchUrlForFullTextSearch(URL baseUrl) { StringBuilder urlTemplate = new StringBuilder(baseUrl.toString()); urlTemplate.append("?"); addParameterToOpenSearchUrl(HttpConstants.TERMS_PARAMETER, OpenSearchConstants.QUERY_SEARCHTERMS_LN, urlTemplate, false);// ww w . j av a 2 s .co m urlTemplate.append("&"); addParameterToOpenSearchUrl(HttpConstants.MAX_PARAMETER, OpenSearchConstants.QUERY_COUNT_LN, urlTemplate, true); urlTemplate.append("&"); addParameterToOpenSearchUrl(HttpConstants.PAGE_PARAMETER, OpenSearchConstants.QUERY_STARTPAGE_LN, urlTemplate, true); return getOpenSearchUrlFromTemplate(urlTemplate); }
From source file:nz.co.senanque.madura.configuration.ConfigNamespaceTest.java
@Test public void testSpringConfig() throws Exception { ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext( getConfigLocations());/* w ww. j a v a 2 s . c o 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()); MyTestBean myTestBean2 = (MyTestBean) applicationContext.getBean("m"); assertTrue("http://localhost:8080/jjj".equals(myTestBean2.getUrl().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:com.uisteps.utils.api.rest.RestApiRequest.java
public RestApiRequest(URL url) { this.host = url.toString(); }
From source file:com.mirth.connect.plugins.directoryresource.DirectoryResourceServlet.java
@Override public List<String> getLibraries(String resourceId) { try {// w ww .j a v a 2 s . c o m DirectoryResourceProperties props = null; ResourcePropertiesList resources = serializer.deserialize(configurationController.getResources(), ResourcePropertiesList.class); for (ResourceProperties resource : resources.getList()) { if (resource instanceof DirectoryResourceProperties && resource.getId().equals(resourceId)) { props = (DirectoryResourceProperties) resource; break; } } List<String> libraries = new ArrayList<String>(); if (props != null) { List<URL> urls = contextFactoryController.getLibraries(props.getId()); if (StringUtils.isNotBlank(props.getDirectory())) { File directory = new File(props.getDirectory()); for (URL url : urls) { libraries.add(StringUtils.removeStartIgnoreCase(url.toString(), directory.toURI().toURL().toString())); } } else { for (URL url : urls) { libraries.add(url.toString()); } } Collections.sort(libraries); } return libraries; } catch (MirthApiException e) { throw e; } catch (Exception e) { throw new MirthApiException(e); } }
From source file:com.wavemaker.commons.io.ResourceURLTest.java
@Test public void shouldCreateExactToFolder() throws Exception { Folder jail = this.root.getFolder("jail").jail(); URL ab = ResourceURL.get(jail.getFolder("a/b")); URL url = new URL(ab, "/x/y/z.txt"); assertThat(url.toString(), Matchers.is(Matchers.equalTo("rfs:/x/y/z.txt"))); assertThat(IOUtils.toString(url.openStream()), Matchers.is(Matchers.equalTo("z"))); }
From source file:jp.go.nict.langrid.dao.entity.EmbeddableURL.java
/** * /*from w w w . j a v a 2s . c o m*/ * */ public void setValue(URL value) { this.original = value; if (value != null) { this.stringValue = value.toString(); } else { this.stringValue = null; } }