我可以使用 Jersey 客户端使用 IPv6 连接到 REST 资源吗?
我收到此错误:
com.sun.jersey.api.client.ClientHandlerException: java.net.MalformedURLException: For input string: ":94ea:d2bc:c189:209c%10:8100"
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:128)
at com.sun.jersey.api.client.Client.handle(Client.java:551)
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:556)
at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:69)
at com.sun.jersey.api.client.WebResource$Builder.put(WebResource.java:475)
at com.bmc.aps.agent.jersey.JerseyClient.put(JerseyClient.java:168)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.net.MalformedURLException: For input string: ":94ea:d2bc:c189:209c%10:8100"
at java.net.URL.<init>(URL.java:601)
at java.net.URL.<init>(URL.java:464)
at java.net.URL.<init>(URL.java:413)
at java.net.URI.toURL(URI.java:1081)
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:139)
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:126)
... 8 more
在例外情况下,ip 被剪切(:94ea:d2bc:c189:209c%10
而不是fe80::94ea:d2bc:c189:209c%10
)。在调试中,我可以看到 Web 资源 URI 是正常的。