URL.getPath() : URL : java.net : Java by API examples (example source code) Organized by topic

Java by API
C++
PHP
Java by API Home »  java.net   » [  URL  ]   
 



URL.getPath()

/*
URL is http://www.java2s.com
authority is www.java2s.com
path is 
default port is 80
query is null
ref is null
 
 */
import java.io.IOException;
import java.net.URL;

public class MainClass {

  public static void main(String[] args) {
    try {
      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();
    }
  }

}

           
       
Related examples in the same category
1.  URL: getAuthority()
2.  URL: getDefaultPort()
3.  URL: getQuery()
4.  URL: getRef()
5.  URL: openStream()
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.