The JAX-RS implementation Jersey supports MVC style web applications through the Viewable class, which is a container for a template name and a model object. It is used like this:
@GET
public Viewable get() {
return new Viewable("/index", "FOO");
}
I wonder how a status code could be returned with this approach. The above would implicitly return 200, but that wouldn’t be appropriate in any case. Is there a way to set a status code explicitly?
You will have to return a
Responseset up with the correct status code and headers containing yourViewable, e.g.: