Hello
We have a resource that might be one of a couple different subtypes.
We've been trying to use variations on Content-Type to identify which
subtype is in play. For example, on the server we might have
public interface Foo {}
public class FooA implements Foo {}
public class FooB implements Foo {}
And then a couple different content types like so:
application/x.foo+json; type=a
application/x.foo+json; type=b
This has been working great with GET requests. We can set the outgoing
content type as we see fit. We're really struggling with POST requests
though. If we define our resource with the following methods then
jersey says they conflict:
@POST
@Consumes("application/x.foo+json; type=a")
public Response create(FooA entity) {}
@POST
@Consumes("application/x.foo+json; type=b")
public Response create(FooB entity) {}
So I guess I have two questions.
1) Is it possible to delegate like this using parameters on the content
type?
2) If not, is it possible for our application to choose the type
(either FooA or FooB to read the json into?)
thanks
sam