package test1;
import java.net.MalformedURLException;
/*
* OUTPUT
--------------------------------
1. getProtocol:http
2. getHost:www.aircondiy.co.kr
3. getPort:8080
4. getPath:/test/abc.jsp
5. getQuery:a1=v1&a2=v2
6. getRef:null
7. getUserInfo:mulder
--------------------------------
*/
public class URLSchemeTester {
/**
* @param args
*/
public static void main(String[] args) {
String url1 = "http://mulder@www.aircondiy.co.kr:8080/test/abc.jsp?a1=v1&a2=v2";
try {
java.net.URL xurl = new java.net.URL (url1);
System.out.println("1. getProtocol:" + xurl.getProtocol());
System.out.println("2. getHost:" + xurl.getHost());
System.out.println("3. getPort:" + xurl.getPort());
System.out.println("4. getPath:" + xurl.getPath());
System.out.println("5. getQuery:" + xurl.getQuery());
System.out.println("6. getRef:" + xurl.getRef());
System.out.println("7. getUserInfo:" + xurl.getUserInfo());
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
}