NOTE: I am asking for real world problem, not for theoretical purpose; see the last part of the question -- the same way browsers do the job.
Usually you would see the answer:
new java.net.URL(new java.net.URL(base_url),rel_url).toString
(base_url和rel_url,
然而,这种法典并不涉及URL碎块,如两件:
htpp://www.hello.com/1.html
?p=2
我测试了< Firefox>、歌剧、Konqueror,“Web Browser”(Gnome miniy ;-D)——所有这些都把“URL”合并为:
htpp://www.hello.com/1.html?p=2
上面的代码如下:
htpp://www.hello.com/?p=2
Question
How do you combine URL fragments, in a ready for world manner?
我希望,在我开始由自己做教之前,已经有这方面的图书馆。