2011年2月5日土曜日

Values returned from java.net.URL methods

URL = {Protocol}://{UserInfo}@{Host}:{Port}{Path}?{Query}#{Ref}
Authority = {UserInfo}@{Host}:{Port}
File = {Path}?{Query}

http://id:password@www.example.com:8080/profile/edit?name=Jack#123

  URL.getProtocol() = http
  URL.getUserInfo() = id:password
  URL.getHost() = www.example.com
  URL.getPort() = 8080
  URL.getPath() = /profile/edit
  URL.getQuery() = name=Jack
  URL.getRef() = 123
  URL.getAuthority() = id:password@www.example.com:8080
  URL.getFile() = /profile/edit?name=Jack

http://www.example.com

  URL.getProtocol() = http
  URL.getUserInfo() = null
  URL.getHost() = www.example.com
  URL.getPort() = -1
  URL.getPath() =
  URL.getQuery() = null
  URL.getRef() = null
  URL.getAuthority() = www.example.com
  URL.getFile() =

http://www.example.com/
 
  URL.getProtocol() = http
  URL.getUserInfo() = null
  URL.getHost() = www.example.com
  URL.getPort() = -1
  URL.getPath() = /
  URL.getQuery() = null
  URL.getRef() = null
  URL.getAuthority() = www.example.com
  URL.getFile() = /