Get Domain Name From Url In Java. URLURL context String spec URLStreamHandler handler Creates an instance of a URL by parsing the given spec with the specified handler within a. With the object created we can access the hostname property which returns a string containing the domain name.
It returns nothing if the port is not described explicitly in the URL. How to get month name from datelike-25062012 using java. Using REMatch To Get The Domain Name If you are using ColdFusion 8 you can use the REMatch function to gather all matches in a given string.
AssertEquals - 1 urlgetPort.
GetProtocol method returns the protocol identifier of the URL. First a URL object is created passing the URL String to its constructor. Creates an instance of a URL from the given protocol name host name and file name. In above lines of code we have created an object of URL class which consists an internet address.