summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/DefaultedURL.java
blob: 8daa7d8c27081bc7871225b7f01758ffcd2e8882 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package se.leap.bitmaskclient;

import java.net.*;

public class DefaultedURL {
    private URL DEFAULT_URL;
    private String default_url = "https://example.net";

    private URL url;

    public DefaultedURL() {
        try {
            DEFAULT_URL = new URL(default_url);
            url = DEFAULT_URL;
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
    }

    public boolean isDefault() { return url.equals(DEFAULT_URL); }

    public void setUrl(URL url) {
        this.url = url;
    }

    public String getDomain() {
        return url.getHost();
    }

    public URL getUrl() {
        return url;
    }

    public String toString() {
        return url.toString();
    }
}