views:

124

answers:

4

I'm trying to figure out what the best options are for developing a RESTful web application with Java EE 6. For example, I want to be able to interpret a URL like so:

GET www.myapp.com/customers/1 - returns a web page displaying details about a customer with id 1.

The only two options I can think of are

  1. Using Spring MVC 3
  2. Using a JAX-RS specification that allows you to render views - I heard RESTEasy integrates with Spring MVC?

Are there any other frameworks that will allow you to develop web applications like this? Also I would greatly appreciate insight as to why one framework may be better than another.

Another consideration of mine is what view technologies can you use with the framework? I've heard that many view technologies integrate with Spring MVC, such as Velocity and Tapestry... are these easily integrated or will I run into numerous problems? One essential is that I need templating (like master pages in ASP.NET).

I'm pretty new to the Java EE world - I'm use to Microsoft where they give you one option. I'm a really big fan of ASP.NET MVC - is there something similar to that in the Java world (or is Spring MVC it?).

I'm not use to all these choices... HELP!

Thanks for any advice/suggestions.

+2  A: 

It's not JavaEE, just JavaSE (some may say that's a Good Thing) but the Play Framework is RESTful, and in my opinion is also very nice to use.

Rich
I've taken a look at Play... it looks really cool. Reminds me a lot of Ruby on Rails (which I really like). It doesn't seem like you can use Java EE (such as EJB 3.1, JPA2) etc.. with it though?
Brian D.
It provides access to JPA but a lot of the other Java EE stuff isn't available - that's why I like it ;) Best thing to do is look at the demo video on their website as it's a good overview of what is there - if it's not in the video it's not in Play, roughly speaking. There are plugins for a lot of other technologies (including JMS and Spring). To be honest, unless you're building an enormous corporate application, Play will probably do the job. It's no good for learning Java EE though!
Rich
+1  A: 

I've decided to go with Spring MVC. I didn't go for JSF 2 because it's just not very RESTful - it seems like a lot of work to get RESTful URLs (having to use plugins), it holds state server-side, and its not action oriented. Play seems like a very cool framework, but it isn't mature enough for me to justify using it yet (and I'm still not sure if you could use Java EE with it).

Spring MVC 3 allows you to map your URL's RESTfully and is action oriented - which I prefer.

I was looking into Grails which looks very promising but is still relatively new and it doesn't look like it has support for Java EE 6 yet.

Brian D.
+3  A: 

I'd recommend you have a look at:

(One question though: why specifically do you need to be able to integrate with Java EE?)

EDIT: In the case where you absolutely want to use the Java EE APIs, then as mentioned by BalusC, JAX-RS is your solution of choice. Restlet and Jersey both support it. I don't know about RESTEasy, but the JAX-RS Wikipedia page mentions it does.

haylem
RESTLet seems really interesting
barjak
Well I want to use Java EE 6 - I like the way the API looks, I just don't want to use JSF.
Brian D.
The seems to be a bit of confusion for you between REST and view components. In any case, I updated my answer, and I'd say you should give RESTLet a shot, or another JAX-RS compatible framework).
haylem
+1  A: 

I'll second @Haylem's recommendation of Restlet. We have a large project that leverages Java EE somewhat (some stateless session beans, Glassfish, a timer bean, servlets, JDBC, JNDI). Restlet fits in very well: you can run a set of web services inside a single Restlet-based servlet. You get an enormous amount of functionality for relatively little effort. We've been quite happy with it.

Jim Ferrans