Robert DiFalco
2014-04-25 20:59:58 UTC
Let's say that I choose to do URI versioning. I know many people are
against this approach but I don't want to spark a discussion on *which*
method I use for versioning. I want to ask HOW I would do it.
What I would like to do (ideally) is have a Container Request Filter that
will see if (for example) there is a V2 contained in the incoming the
request path. If there *is* the filter will look to see if there is a
resource with an exact match for this path. If there is *NOT* an exact
match it will modify the request URI to use the V1 version of the resource
method.
By doing this I do not need to create a "api/v2/whatever" version of every
resource path. I will only need to modify those that differ from version 1.
For example, if I have the @Path "api/user/info" but no @Path
"api/v2/user/info" then the filter will remap the "api/v2/user/info" to
"api/user/info".
Is there a way to do this? Is there a better approach to take for URI
versions with JAX-RS?
Thanks.
against this approach but I don't want to spark a discussion on *which*
method I use for versioning. I want to ask HOW I would do it.
What I would like to do (ideally) is have a Container Request Filter that
will see if (for example) there is a V2 contained in the incoming the
request path. If there *is* the filter will look to see if there is a
resource with an exact match for this path. If there is *NOT* an exact
match it will modify the request URI to use the V1 version of the resource
method.
By doing this I do not need to create a "api/v2/whatever" version of every
resource path. I will only need to modify those that differ from version 1.
For example, if I have the @Path "api/user/info" but no @Path
"api/v2/user/info" then the filter will remap the "api/v2/user/info" to
"api/user/info".
Is there a way to do this? Is there a better approach to take for URI
versions with JAX-RS?
Thanks.