Is RESTful JSF possible?

SingleShot picture SingleShot · Sep 15, 2009 · Viewed 21.6k times · Source

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)?

Answer

Hank Gay picture Hank Gay · Sep 15, 2009

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.