格式错误的Java Net URL

时间:2012-02-13 23:08:09

标签: java http url

我正在制作这样的网址

url = new URL("http","localhost",9080,"/path/to/my/resource/myAction.action");

而不是制作网址:

http://localhost:9080/path/to/my/resource/myAction.action

提出要求:

http://www.localhost.com/path/to/my/resource/myAction.action

1 个答案:

答案 0 :(得分:1)

试试这个:

url = new URL("http://localhost:9080/path/to/my/resource/myAction.action");