How to check given domain name http or https in java?

后端 未结 7 995
说谎
说谎 2021-01-11 10:48

My problem

In my android application I get url input from user, like \"www.google.com\".

I want to find out for the given url whether to use

7条回答
  •  佛祖请我去吃肉
    2021-01-11 11:35

    A hierarchical URI is subject to further parsing according to the syntax [scheme:][//authority][path][?query][#fragment]

    so your url_name lack of scheme. if url_name is "https://www.google.com", so the scheme is https.

    refer: http://docs.oracle.com/javase/7/docs/api/java/net/URI.html

提交回复
热议问题