Skip to content

HasanMhdAmin/getSLD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Get SLD (second level domain)

get the SLD (second level domain) of a URL

Usage

download the JAR file from lib/Hostname-1.0-SNAPSHOT.jar and add it in your project.

String host = Hostname.getHostname("https://www.example.com");
How to add it to maven pom.xml?
<dependency>
    <groupId>com.github.HasanMhdAmin</groupId>
    <artifactId>Hostname</artifactId>
    <version>1.0-SNAPSHOT</version>
    <scope>system</scope>
    <systemPath>${basedir}/lib/Hostname-1.0-SNAPSHOT.jar</systemPath>
</dependency>
<!--...-->
<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <includeSystemScope>true</includeSystemScope>
    </configuration>
</plugin>

Sample

suppose you have these URLs:

The output to be only the host name, in the previous example the result for all domains should be example.

Author

Hasan Mhd Amin on GitHub @HasanMhdAmin

About

get the Second Level Domain of a URL

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages