Java Authenticator getRequestingProtocol() Method

The getRequestingProtocol() method of Authenticator class give the protocol that is requesting the connection. This will be based on a URL.

Syntax:

Parameter:

No parameter is passed.

Return:

The protocol used.

Throw:

Does not throw any Exception

Example 1

Test it Now

Output:

Protocol Used:  https
Host using url.getHost ::www.javatpoint.com
Protocol:null
//source code of https://www.javatpoint.com is printed

Example 2

Test it Now

Output:

null
Protocol Used:  https
// Source code of https://www.javatpoint.com is printed. 





Latest Courses