Reputation: 634
Is it possible to load the value for the @PATH annotation from configuration (web.xml, etc) for a given class?
@Path(<value loaded from config>)
public class myRestService {
...
Upvotes: 2
Views: 342
Reputation: 2620
You can add path programmatically, as shown in JAX-RS Jersey, how to dynamic adding resources or providers to Application
which means you can then wire it your configuration .
Upvotes: 0
Reputation: 10971
Independent of JAX-RS: Annotations in Java are compile time constants so they can't be changed at runtime.
I don't know your use case but possible ways to change the values of the annotations are:
@Path
annotations dynamically like described here./*
which decides which subresource should be returned.No comment if one of these approaches makes sense as I don't know why you want to change them. As the URI names a resource I don't see any reason to change it. See also: Cool URIs don't change
Update: JAX_RS_SPEC-60 requests "A Dynamic way to register JAX-RS resources (not based on annotations)".
Upvotes: 2