URIUtils.createURI被Deprecated的解决

简介: 版权声明:本文为博主chszs的原创文章,未经博主允许不得转载。 https://blog.csdn.net/chszs/article/details/45893191 URIUtils.createURI被Deprecated的解决作者:chszs,转载需注明。
版权声明:本文为博主chszs的原创文章,未经博主允许不得转载。 https://blog.csdn.net/chszs/article/details/45893191

URIUtils.createURI被Deprecated的解决

作者:chszs,转载需注明。博客主页:http://blog.csdn.net/chszs

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

public static URI createURI(String scheme,
                   String host,
                   int port,
                   String path,
                   String query,
                   String fragment)
                 throws URISyntaxException

仔细看了URIUtils的所有方法,但没有任何新方法可以代替此方法,那么该怎么办呢?

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

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

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 ?
886 0
error `slot` attributes are deprecated
error `slot` attributes are deprecated
error ‘.native‘ modifier on ‘v-on‘ directive is deprecated
error ‘.native‘ modifier on ‘v-on‘ directive is deprecated
|
10月前
|
iOS开发
‘authorizationStatus‘ is deprecated: first deprecated in iOS 14.0
‘authorizationStatus‘ is deprecated: first deprecated in iOS 14.0
143 0
|
数据库连接
(node:2612) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
(node:2612) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
jpa中PageRequest @Deprecated和Sort @Deprecated的最新使用方法
jpa中PageRequest @Deprecated和Sort @Deprecated的最新使用方法
【问题记录】utureWarning: Function get_feature_names is deprecated; get_feature_names is deprecated in 1.0
【问题记录】utureWarning: Function get_feature_names is deprecated; get_feature_names is deprecated in 1.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
319 0
|
API
'getWidth()' is deprecated,'getHeight()' is deprecated
'getWidth()' is deprecated,'getHeight()' is deprecated
159 0
'getWidth()' is deprecated,'getHeight()' is deprecated
mTabLayout.setOnTabSelectedListener is deprecated
mTabLayout.setOnTabSelectedListener is deprecated
153 0
mTabLayout.setOnTabSelectedListener is deprecated

热门文章

最新文章