users@jax-rs-spec.java.net

[jax-rs-spec users] Re: [jsr339-experts] MVC

From: arjan tijms <arjan.tijms_at_gmail.com>
Date: Mon, 2 Jun 2014 00:46:17 +0200

Hi,

On Thu, May 22, 2014 at 11:05 PM, Santiago Pericas-Geertsen <
Santiago.PericasGeertsen_at_oracle.com> wrote:

> As you may have seen in the Java EE 8 survey, there was significant
> interest in adding an MVC framework to the platform in EE 8. After some
> analysis, we are convinced that the best place for this work is in
> JAX-RS.next. In fact, as many of you may recall, this was on our list for
> JAX-RS 2.0 but we've never got a chance to discuss it in any detail.


First of all I like to mention I really like JAX-RS as it is and have been
using the technology for pretty much every web service that I've
implemented.

However, I'm not a really big fan of the current plans of adding MVC and
SSE to it. Combined with the fact that JAX-RS still has its own injection
(@Context) despite a platform standard for this and some of its own
security types (e.g. SecurityContext) that could have been useful for the
entire platform, I fear that users might increasingly get the feeling that
JAX-RS is a kind of full stack framework itself. With JAX-RS being a part
of Java EE which is a full stack framework, I'm not sure if we aren't
confusing users with such a setup.

The question is also why specifically a RESTful web services framework
should be extended with an MVC framework. Web services are about doing a
very specific thing and I have a feeling that an MVC web framework is not
exactly that thing. I guess people might frown about the idea of
introducing an MVC web framework into JAX-WS, but what is really the
difference between those two? Why would it be acceptable to add an MVC
framework to one type of web services framework, but not to the other?

As an extreme and obviously not realistic example, but wouldn't it also be
somewhat similar to extending EJB with an MVC framework in such a way that
e.g. rendered pixels or even high level graphics commands for some toolkit
are sent over the @Remote RMI/IIOP connection?

One explanation that I've seen (in the SSE thread) is that JAX-RS should be
extended with the MVC framework because it has such a modern and nice to
use @Path annotation for routing URL requests, as compared to Servlets
which only has the more primitive @WebServlet with rather crude URL
patterns. If that is indeed the case, couldn't it be a possible alternative
to take the @Path annotation out of JAX-RS and separate it into its own
spec dedicated to URL routing? (e.g. the URL routing JSR). That way the
entire platform (specifically Servlet and JSF) could use the advanced URL
routing and path/parameter extraction features and there might not be a
need anymore to increase the size of a web services framework with an MVC
framework.

Things like this have been done before, e.g. EL was separated from JSP and
JSF, and persistence was separated from EJB (as JPA).

There's obviously much to discuss at a technical level concerning how JSF
can take advantage of action oriented concepts and in what way this could
be implemented best, but perhaps we should focus first on the question of
whether it's really a good idea or even needed to do any part of this
specifically in JAX-RS?

Kind regards,
Arjan Tijms