The way the interfaces are generated with the raml-jaxrs-codegen maven plugin is nice because it makes it very easy to implement the services and not be bogged down with having to put all the jaxrs annotations on things.
One thing that is missing currently is an easy way to handle headers for caching. The response object could easily be modified to support sending back cache control headers, but for those to be of use the interface methods would need access to the incoming headers to be able to potentially short-circuit long calculations and quickly return 304’s for non-modified content.
Has anyone thought of how to do this? The authors behind the current jaxrs-raml-codegen seem to have a pretty good grasp around building code generators so I’d be interested in their take on how to add support for caching to their existing stuff (or perhaps it will require a different approach than what is currently in place)
There are a couple of articles out there about doing caching in jax-rs - like https://devcenter.heroku.com/articles/jax-rs-http-caching - but the general idea is to evaluate the headers early and return quickly if you can, otherwise return the real content.