Is it possible with Dropwizard to define a resource like this using interfaces?
@Path("/myResource")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public interface MyResource {
Response createSomething();
}
public class MyResourceImpl implements MyResource {
@Override
public Response createSomething() {
...//do some stuff
}
}
When I tried several different patterns of adding this resource I couldn't get it to register with jersey properly.
environment.jersey().register(new MyResourceImpl());
The primary reason for even having this interface is so that we can dynamically generate a client from this interface by doing something like:
DropwizardClientProxy<MyResource> clientProxy = new DropwizardClientProxy(config, e, MyResource.class);
MyResource myResource = clientProxy.getResourceInterface();
Response r = myResource.createSomething();
We got everything working to support this, but the only way we can get this working currently is to duplicate the annotations on the interface and the implementation. I've read that a bunch of things like this seem to be supported in Jersey 2 (haven't tried it yet), but it seems like this should work with Jersey 1...
Anyone ever get this to work?
Thanks,
Brent