URIUtils.createURI被Deprecated的解决

简介: URIUtils.createURI被Deprecated的解决 在使用Apache HttpClient 4.4.1版开发代码时,无意中发现org.apache.http.client.utils.URIUtils.createURI()方法被废弃了。
URIUtils.createURI被Deprecated的解决
在使用Apache HttpClient 4.4.1版开发代码时,无意中发现org.apache.http.client.utils.URIUtils.createURI()方法被废弃了。此方法的完整描述如下:

点击(此处)折叠或打开

  1. public static URI createURI(String scheme,
  2.                        String host,
  3.                        int port,
  4.                        String path,
  5.                        String query,
  6.                        String fragment)
  7.                      throws URISyntaxException
仔细看了URIUtils的所有方法,但没有任何新方法可以代替此方法,那么该怎么办呢?

查看API文档,据官方说,此方法是从HttpClient 4.2版以后开始标记为Deprecated的。官方推荐使用URI类来取代它。
详述如下:

java.net.URI类的构造方法:

点击(此处)折叠或打开

  1. URI(String scheme, String userInfo, String host, int port, String path, String query, String fragment)
参数说明

scheme:协议名
userInfo:用户名及授权信息
host:主机名
port:端口号
path:路径
query:查询
fragment:片段

目录
相关文章
|
小程序 JavaScript API
Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ?
Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ?
788 0
error ‘.native‘ modifier on ‘v-on‘ directive is deprecated
error ‘.native‘ modifier on ‘v-on‘ directive is deprecated
|
5月前
|
iOS开发
‘authorizationStatus‘ is deprecated: first deprecated in iOS 14.0
‘authorizationStatus‘ is deprecated: first deprecated in iOS 14.0
68 0
|
5月前
Classic mode for store/ is deprecated and will be removed in Nuxt 3
Classic mode for store/ is deprecated and will be removed in Nuxt 3
97 0
|
10月前
|
数据库连接
(node:2612) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
(node:2612) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
|
11月前
|
Java
jpa中PageRequest @Deprecated和Sort @Deprecated的最新使用方法
jpa中PageRequest @Deprecated和Sort @Deprecated的最新使用方法
|
开发工具
WARNING: library configuration mismatch
WARNING: library configuration mismatch
288 0
CMake 3.7.2 or higher is required. You are running version 2.8.12.2
CMake 3.7.2 or higher is required. You are running version 2.8.12.2
278 0
|
API Python
全网首发:warning: #warning “Using deprecated NumPy API, disable it by “ “#defining NPY_NO_DEPRECATED_API
全网首发:warning: #warning “Using deprecated NumPy API, disable it by “ “#defining NPY_NO_DEPRECATED_API
261 0