Sunday, July 28, 2013

Jersey 2 client - no pathParam

I came across the pathParam in the Jersey 2 client documentation the other day and thought it would be useful in various client requests:
https://jersey.java.net/documentation/latest/migration.html#mig-client-simple-request
Specifically, this line in the JAX-RS 2.0 way:
String result = target.pathParam("param", "value").get(String.class);

However, coding it up ran into a problem very quickly - namely that the method wasn't available on a WebTarget class!  Searching the jar confirmed that, but searching the internet didn't turn up much besides this:
https://java.net/projects/jax-rs-spec/lists/jsr339-experts/archive/2012-09/message/22
Which looks like the beginning of the discussion to remove pathParam :)
So, the lesson is: ignore that line in the documentation!

No comments:

Post a Comment