I have an issue resolving a class-level @Path annotation on a interface as such. I'm passing this interface to a WebResourceFactory in Jersey proxy client but it's immediately failing with an IllegalStateException.
The interface definition:
@Path("{entity}")
public interface EntityResource {
@GET
@Produces("*/xml")
Entity get(@PathParam("view") EntityType view);
}
The exception I get:
Exception in thread "main" java.lang.IllegalStateException: The template variable 'entity' has no value
at org.glassfish.jersey.client.JerseyWebTarget.getUri(JerseyWebTarget.java:135)
at org.glassfish.jersey.client.JerseyWebTarget.request(JerseyWebTarget.java:215)
at org.glassfish.jersey.client.JerseyWebTarget.request(JerseyWebTarget.java:60)
at org.glassfish.jersey.client.proxy.WebResourceFactory.invoke(WebResourceFactory.java:322)
Any suggestions on how to resolve the "entity" template variable?
After doing some investigation in the jersey-proxy-client source code, I found that all template variables are resolved with annotations on the method declaration. There was an issue in how Apache CXF generated my interfaces. I have a mismatch between the @PathParam and the @Path. @Path uses "entity" and my @PathParam uses "view". They both need to be the same in order for the template variable to resolve correctly.