Java Authenticator getRequestingHost() Method

The getRequestingHost() method of Authenticator Class is used to get the hostname of the site or proxy requesting authentication, or null if not available.

Syntax:

Parameter:

No parameter is passed.

Return:

The hostname of the connection requiring authentication, null if it's not available.

Throw:

Does not throw the exception.

Example 1

Test it Now

Output:

Host using url.getHost ::www.javaTpoint.com
hostname:null
//The source code of https://www.javatpoint.com will be printed

Example 2

Test it Now

Output:

Hostname:null





Latest Courses