Request URL
http://user:passwd@30thh.loc:8480/test%3F+b;?p+1=c+d&p+2=e+f#ref
getAuthority() | user:passwd@30thh.loc:8480 |
getDefaultPort() | 80 |
getFile() | /test%3F+b;?p+1=c+d&p+2=e+f |
getHost() | 30thh.loc |
getPath() | /test%3F+b; |
getPort() | 8480 |
getProtocol() | http |
getQuery() | p+1=c+d&p+2=e+f |
getRef() | ref |
getUserInfo() | user:passwd |
toString() | http://user:passwd@30thh.loc:8480/test%3F+b;?p+1=c+d&p+2=e+f#ref |
URL base1 = new URL("http://localhost:8090/home/");
System.out.println(new URL(base1,"Service.json"));
// http://localhost:8090/home/Service.json
System.out.println(new URL(base1,"/Service.json"));
// http://localhost:8090/Service.json
System.out.println(new URL(base1,"./Service.json"));
// http://localhost:8090/home/Service.json
URL base2 = new URL("http://localhost:8090/home/index");
System.out.println(new URL(base2,"Service.json"));
// http://localhost:8090/home/Service.json
System.out.println(new URL(base2,"/Service.json"));
// http://localhost:8090/Service.json
System.out.println(new URL(base2,"./Service.json"));
// http://localhost:8090/home/Service.json
0 回應:
張貼留言