[jax-rs-spec users] Re: [jsr344-experts mirror] JAX-RS MVC

From: <>
Date: Tue, 3 Jun 2014 19:07:00 +0000 (UTC)

On Fri, 30 May 2014 01:10:27 +0100 (BST) Adrian Gonzalez wrote:

AG> // JAX-RS should be able to bind form data to complex data objects
AG> // must give us a BindResult to handle binding failure and redirect
AG> // user to the input page if need be

AG> @Path("/{id}")
AG> @Produces("application/json")
AG> public ActionResult edit(Client client, BindResult bindResult) {
AG> if (bindResult.isValid()) {
AG> return ok(list.redirect(clientManager.update(client));
AG> } else {
AG> return badRequest(show.render(client));
AG> }
AG> }

In my experience with JSF, a binding failure is a more fine grained
result than per-request. A binding failure is a specific kind of
per-field validation failure. It's perfectly possible that some
bindings would succeed and others fail within the scope of a single
request. JSF allows individual handling for each such validation

AG> * JAX-RS must be able to convert HTTP POST parameters (multipart or
AG> not) to a java object

Yes, this is analogous to the Struts FormBean concept.

AG> Notes about the view :

AG> * template inclusion mechanism (main references a page names 'main'
AG> - just like in Play).

AG> * reusable blocks (i.e. @inputText)

AG> * @ instead of XML to include dynamic code (less verbosity) - just
AG> like in GSP, ASP .NET MVC 5 (Razor) and Playframework

I'm glad to see you agree on the value of having a template inclusion
mechanism, though I disagree with your suggestion to introduce an
entirely new syntax to EE. In EE, people are already used to Facelets.

There is no question that your suggestion is simpler than XML. We are
fully committed to making the templating language pluggable as in
MVC. Furthermore, we must keep in mind our need to be very judicious
our decisions to invent new syntax and write new implementation code to
support it.

AG> Groovy template see

No question this is very powerful. Again, the pluggable template
language must support this solution.