I recently sat down to port a simple Rails app I have to JSF (using Seam) to get a feel for which I would be more productive in. The Rails app is RESTful, which I like. Upon starting into JSF, I was surprised to learn, perhaps incorrectly, that JSF only support POSTs, which makes it inherently non-RESTful.
I searched around a bit but cannot find a satisfactory answer. JSF/Seam appears to be very popular, but it doesn't make sense to me that it would forbid all HTTP methods but POST. Is it true that JSF inherently does not allow for a RESTful architecture, or am I wrong and RESTful JSF is possible (inherently or through a plug-in)?
Depending on your exact requirements (REST as API or more as a means to get bookmarkable URLs), Seam is farther along than lead on. An article from the Seam developers is at http://relation.to/Bloggers/RESTSupportInLatestSeam21 where it demonstrates the new REST features. Among others how you can expose full access to an entity via a RESTful API with just four lines of XML.
If you just go for bookmarkable you still have to carefully design how you link things (together) in your JSF pages and flows, although Seam 2.2 added some features to make this easier.
JSF with seam can do GET fine. It just depends on what you want to do with it. JSF usually uses post to get your field data to the back end. A lot of JSF stuff works with post. But you certainly can use GET using Seam Page parameters or even just getting to the underlying HTTPRequest object.
Now the greater RESTful architecutre, yes, doesn't work well with JSF. Feel free, however, to use JSF for your user-interface and JAX-RS for your RESTful API. Both can live happily next to one another.
JSF is a component based framework, not an action based one. URLs are definitely action-related, so if you want to do a RESTful web application JSF is maybe not what you want.
See also:
Here's a blog post that works through this question, though it doesn't reach any solid conclusions.
In my personal experience, JSF/Seam aren't actually very popular, due in large part to these sorts of issues. It seems to try very hard to abstract away from the underlying nature of the web, and then breaks things like
GET
. The fix (for whatever problem you're having) is always "coming in the next version" or "not really a problem if you have good tools." YMMV, but I'd probably look at a different stack.I've heard good things about Restlet, and I see that Struts 2 has a REST plugin. With Spring 3, Spring MVC has added support for REST. I've worked with Grails, and it made doing RESTful things fairly straightforward. It has the added bonus that it should be very familiar to you, since you're experienced with Rails.