List of usage examples for java.net URL toString
public String toString()
From source file:Main.java
public static void main(String[] argv) throws Exception { URL url = new URL("http://java2s.com:80/index.html"); System.out.println(url.toString()); }
From source file:Main.java
public static void main(String[] args) throws Exception { URL url = new URL(args[0]); System.out.println("URL is " + url.toString()); System.out.println("protocol is " + url.getProtocol()); System.out.println("authority is " + url.getAuthority()); System.out.println("file name is " + url.getFile()); System.out.println("host is " + url.getHost()); System.out.println("path is " + url.getPath()); System.out.println("port is " + url.getPort()); System.out.println("default port is " + url.getDefaultPort()); System.out.println("query is " + url.getQuery()); System.out.println("ref is " + url.getRef()); }
From source file:MainClass.java
public static void main(String[] args) { try {//from ww w. j a v a 2s . com URL url = new URL("http://www.java2s.com"); System.out.println("URL is " + url.toString()); System.out.println("authority is " + url.getAuthority()); System.out.println("path is " + url.getPath()); System.out.println("default port is " + url.getDefaultPort()); System.out.println("query is " + url.getQuery()); System.out.println("ref is " + url.getRef()); } catch (IOException e) { e.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { try {//w w w . j a va2s.c o m URL url = new URL("http://www.java2s.com/query?abc=def"); System.out.println("URL is " + url.toString()); System.out.println("authority is " + url.getAuthority()); System.out.println("default port is " + url.getDefaultPort()); System.out.println("query is " + url.getQuery()); } catch (IOException e) { e.printStackTrace(); } }
From source file:com.hp.test.framework.Reporting.TestPath.java
public static void main(String ar[]) throws IOException { URL location = Test.class.getProtectionDomain().getCodeSource().getLocation(); String path = location.toString(); path = path.substring(6, path.indexOf("lib")); String Logos_path = path + "ATU Reports/HTML_Design_Files/IMG"; String Source_logs_path = path + "HTML_Design_Files/IMG"; String Source_Framework_Logo_path = Source_logs_path + "/Framework_Logo.jpg"; String Source_hp_logo_path = Source_logs_path + "/hp.png"; String Source_reports_path = Source_logs_path + "/reports.jpg"; File Target_dir = new File(Logos_path); File Source = new File(Source_Framework_Logo_path); FileUtils.copyFileToDirectory(Source, Target_dir); File Source_Reports = new File(Source_reports_path); FileUtils.copyFileToDirectory(Source_Reports, Target_dir); File Source_hp = new File(Source_hp_logo_path); FileUtils.copyFileToDirectory(Source_hp, Target_dir); }
From source file:Main.java
public static void main(String[] argv) throws Exception { URI uri = null;//from www.j a v a 2 s .c o m URL url = null; // Create a URI uri = new URI("file://D:/1.4/Ex1.java"); url = uri.toURL(); uri = new URI(url.toString()); }
From source file:info.bitoo.utils.BiToorrentRemaker.java
public static void main(String[] args) throws IOException, TOTorrentException { CommandLineParser parser = new PosixParser(); CommandLine cmd = null;//from ww w . j a v a 2 s .c o m try { cmd = parser.parse(createCommandLineOptions(), args); } catch (ParseException e) { System.err.println("Parsing failed. Reason: " + e.getMessage()); } StringTokenizer stLocations = new StringTokenizer(cmd.getOptionValue("l"), "|"); List locations = new ArrayList(stLocations.countTokens()); while (stLocations.hasMoreTokens()) { URL locationURL = new URL((String) stLocations.nextToken()); locations.add(locationURL.toString()); } String torrentFileName = cmd.getOptionValue("t"); File torrentFile = new File(torrentFileName); TOTorrentDeserialiseImpl torrent = new TOTorrentDeserialiseImpl(torrentFile); torrent.setAdditionalListProperty("alternative locations", locations); torrent.serialiseToBEncodedFile(torrentFile); }
From source file:demo.wssec.client.Client.java
public static void main(String args[]) throws Exception { if (args.length == 0) { System.out.println("please specify wsdl"); System.exit(1);// w w w . j a v a 2 s .c o m } URL wsdlURL; File wsdlFile = new File(args[0]); if (wsdlFile.exists()) { wsdlURL = wsdlFile.toURI().toURL(); } else { wsdlURL = new URL(args[0]); } SpringBusFactory bf = new SpringBusFactory(); URL busFile = new ClassPathResource("wssec-client.xml").getURL(); Bus bus = bf.createBus(busFile.toString()); SpringBusFactory.setDefaultBus(bus); SpringBusFactory.setThreadDefaultBus(bus); Service service = Service.create(wsdlURL, SERVICE_NAME); Greeter port = service.getPort(PORT_NAME, Greeter.class); System.out.println("Invoking greetMe..."); try { String resp = port.greetMe(System.getProperty("user.name")); System.out.println("Server responded with: " + resp); System.out.println(); } catch (Exception e) { System.out.println("Invocation failed with the following: " + e.getCause()); System.out.println(); } System.exit(0); }
From source file:no.met.jtimeseries.CreateChart.java
public static void main(String[] args) throws Exception { URL resource = CreateChart.class.getClassLoader().getResource("locationforecast/forecast.xml"); GenericDataModel model = MeteogramWrapper.getModel(resource.toString(), null); ChartPlottingInfo cpi = new ChartPlottingInfo.Builder(0, 0).altitude(0).width(800).height(300) .showAirTemperature(true).showDewpointTemperature(true).showPressure(true).timezone("UTC") .showCloudSymbol(true).showWeatherSymbol(true).showWindSymbol(true).showPrecipitation(true) .showWindSpeed(true).showWindDirection(true).windSpeedUnit("knop").build(); JFreeChart chart = getShortTermChart(model, cpi); //JFreeChart chart = getLongTermChart(model, cpi); show(chart);/*from w w w .j ava2 s . co m*/ }
From source file:io.apiman.servers.gateway_es.Starter.java
/** * Main entry point for the API Gateway micro service. * @param args the arguments/*from w ww . jav a 2 s . co m*/ * @throws Exception when any unhandled exception occurs */ public static final void main(String[] args) throws Exception { URL resource = Starter.class.getClassLoader().getResource("users.list"); //$NON-NLS-1$ if (resource != null) { System.setProperty(Users.USERS_FILE_PROP, resource.toString()); } loadProperties(); GatewayMicroService microService = new GatewayMicroService(); microService.start(); microService.join(); }