Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is Spring MVC a REST Framework?

I've seen many examples of what is called Spring REST which basically all are simply Spring MVC. Granted that using JAXB, and JAXON you can provide XML, and JSON responses, but there is more to REST than just providing text response.

One major issue is that non of these examples mention anything about session; a REST application is supposed to be session-less, but Spring MVC is certainly session-full.

So, does Spring MVC somehow disables session, or are we supposed to disable session when we use Spring MVC to implement REST?

If we are supposed to disable session; then how is it that done?

like image 233
user1888243 Avatar asked Apr 10 '13 03:04

user1888243


1 Answers

  • Spring MVC does not enable sessions until you use them;

  • I fully agree that the so-called "rest support" in Spring should have been called "pretty urls and Jackson integration", but nowadays it has little market-appeal (even though pretty URLs and JSON are the only thing people associate with REST; that and mapping CRUD to http verbs).

  • REST is an architectural choice that has nothing to do with sessions (nor pretty urls, nor json). Since it is more of a religion than an actual technique, nobody will translate it for you to a fixed set of practices. You could have sessions modeled as resources that get created when user logs in and that disappear after some time. And so on.

like image 179
fdreger Avatar answered Sep 18 '22 03:09

fdreger