sporttery.cn
String url = "http://www.Google.com/search?hl=en&q=httpclient&btnG=Google+Search&aq=f&oq=";
URIbuilder uriBuilder = new URIBuilder(url);
System.out.println(uriBuilder.getScheme());
System.out.println(uriBuilder.getUserInfo());
System.out.println(uriBuilder.getHost());
System.out.println(uriBuilder.getPort());
System.out.println(uriBuilder.getPath());
System.out.println(uriBuilder.getQueryparams());
System.out.println(uriBuilder.getFragment());
System.out.println(uriBuilder.getCharset());
输出如下所示:
scheme:http
userinfo:null
host:www.google.com
prot:-1 端口默认是80,当显示指定端口时,此处便能取到值
path:/search
queryParams:[hl=en, q=httpclient, btnG=Google Search, aq=f, oq=]
fragment:null
charset:null
某些属性含义未知手动设置一次
String url = "http://info.sporttery.cn/football/info/fb_match_hhad.php?m=102909";
URIBuilder uriBuilder = new URIBuilder(url);
uriBuilder.setFragment("111");
uriBuilder.setUserInfo("222", "333");
uriBuilder.setCharset(new GBK());
System.out.println(uriBuilder.build());
System.out.println(uriBuilder.getScheme());
System.out.println(uriBuilder.getUserInfo());
System.out.println(uriBuilder.getHost());
System.out.println(uriBuilder.getPath());
System.out.println(uriBuilder.getQueryParams());
System.out.println(uriBuilder.getFragment());
System.out.println(uriBuilder.getCharset());
输出如下:
http://222:[email protected]/football/info/fb_match_hhad.php?m=102909#111
scheme:http
userInfo:222:333 没见过这东西-。-
host:info.sporttery.cn
path:/football/info/fb_match_hhad.php
queryParams:[m=102909]
fragment:111 路由
charset:GBK
URIBuilder addparameter(final String param, final String value)
String url = "http://info.sporttery.cn/football/info/fb_match_hhad.php?m=102909";
URIBuilder uriBuilder = new URIBuilder(url);
uriBuilder.setParameter("m", "2");
uriBuilder.addParameter("m" ,"5");
System.out.println(uriBuilder.build());
输出:http://info.sporttery.cn/football/info/fb_match_hhad.php?m=2&m=5
得出结论:set会覆盖原来的同名参数而add不会
URIBuilder clearParameters()
String url = "http://info.sporttery.cn/football/info/fb_match_hhad.php?m=102909";
URIBuilder uriBuilder = new URIBuilder(url);
uriBuilder.clearParameters();
System.out.println(uriBuilder.build());
输出:http://info.sporttery.cn/football/info/fb_match_hhad.php
就是清除所有参数
相关阅读
由seo实验室与腾讯大讲堂联合主办的2017中国产品经理大会:解码未来产品经理在深圳宝立方国际博览中心如期举行。小米开发者生态团
淘宝网卖家在进行无线端店铺装修时,一般会添加优惠券营销模块,而PC网页端创建的优惠券的链接是PC端的适配地址,并不能直接复制至无线
我喜欢浏览网页时多个心眼。这个心眼需要观察许多元素,每个元素都能提供信息。孤立的一个元素不重要,但是多个元素组成的信息,往往能
这个系列主要是给大家介绍整个互联网产品的构建、产品研发的过程。产品的形态既然我们要跟大家去介绍整个互联网产品的构建、产品
curl请求显示各部分耗费时间 curl -o /dev/null -s -w %{time_namelookup}::%{time_connect}::%{time_starttransfer}::%{time_to