users@jersey.java.net

RE: [Jersey] Resource and XML Schema versioning...

From: Rabick, Mark A (MS) <"Rabick,>
Date: Thu, 26 Feb 2009 10:51:06 -0600

> On Feb 25, 2009, at 6:08 PM, Rabick, Mark A (MS) wrote:
>
> >> As far as the URI-based content negotiation, are you suggesting I
> >> could couple the URI 'versioning' (../v1/...) in addition
> to custom/
> >> specific media types when the client can't send an "Accept:
> >> application/foo-vi?
> >>
> >
> > I think a suffix is better e.g. ".foo-v1" or ".foo-v2". Then it is
> > easier to use existing Jersey functionality or write your
> own filter.
> >
> > Are you talking about a suffix in a URI fragment? For example, if I
> > have 2 versions of 'Foo' JAXB objects.
> >
>
> A suffix at the end of the URI path, but not part of the application
> and @Path.

Not part of the application I assume would be not in the 'context-root'
of the web app. Sorry to belabor this but how can a suffix be at the
end of the URI path, but NOT Included in an @Path?
Can you give an example?


> > Ie. http://host:8080/fooapplication/foo.foo-v1/
> >
> > public class FooV1Resource {
> >
> > @GET @Path("/foo.foo-v1/{id}")
> > @Produces("application/foo-v1")
> > public FooV1(String @PathParam("id") String fooId) {
> >
> > FooV2 foo2 = FooDatabase.getFooById(fooId);
> > FooV1 foo1 = convertFoo2ToFoo1(foo2)
> > return foo1;
> > }
> > }
> >
> > Ie. http://host:8080/fooapplication/foo.foo-v2/
> >
> > public class FooV2Resource {
> >
> > @GET @Path("/foo.foo-v2/{id}")
> > @Produces("application/foo-v2")
> > public FooV2(String @PathParam("id") String fooId) {
> > FooV2 foo2 = FooDatabase.getFooById(fooId);
> > return foo2;
> > }
> > }
> >
> > With the appropriate ContextResolvers based on the media types, of
> > course...
> >
> > What 'existing Jersey functionality' are you referring to that
> > suffixes would help with?
> >
>
> See:
>
>
https://jersey.dev.java.net/source/browse/*checkout*/jersey/tags/jersey-
1.0.2/api/jersey/com/sun/jersey/api/core/ResourceConfig.html#getMediaTyp
eMappings()
>
> Paul.
>
>