0

我有一个需要包含在另一个中的 url。到目前为止,我有:

String urlString = "http://company.com/action?sourceUrl=http://stackoverflow.com/foo"
URL url = new URL(urlString);

我怎样才能确保这个网址不会被弄乱?我的意思是,例如,如果我需要另一个参数怎么办:

String urlString = "http://company.com/action?sourceUrl=http://stackoverflow.com/foo&count=1"
URL url = new URL(urlString);

这现在是模棱两可的。count 属于外部 URL 还是内部 URL?我该如何解决这种情况,一般来说,在另一个 URL 中添加一个 URL,然后在 Java 中发出请求?

4

0 回答 0