Java Authenticator getRequestingProtocol() 方法

2025 年 3 月 20 日 | 阅读 2 分钟

Authenticator 类的 getRequestingProtocol() 方法用于获取请求连接的协议。这将基于一个 URL。

语法

参数

不传递任何参数。

返回

所使用的协议。

Throw

不抛出任何异常

示例 1

输出

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

示例 2

输出

null
Protocol Used:  https
// Source code of https://tpointtech.cn is printed.