Jersey IPv6 Client

Can jersey client be used to connect to REST resource using IPv6?

I am getting this error:

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

      

In this case, ip is stripped ( :94ea:d2bc:c189:209c%10

instead of fe80::94ea:d2bc:c189:209c%10

). In debug, I can see that the URI of the web resource is ok.

+3


source to share


1 answer


Found the answer.

The Jersey client expects to receive an IP address with square brackets []

.



In this example, [fe80::94ea:d2bc:c189:209c%10]

instead of - fe80::94ea:d2bc:c189:209c%10

.

+1


source







All Articles