On Fri, Dec 2, 2011 at 8:31 AM, Mark Kharitonov <mark.kharito...@gmail.com>wrote:
> Anyway, the developer should have the freedom of choice and if it is more > suitable in the particular application to group POST together with GET, PUT > and DELETE then the REST framework should support it. > Restlet can support all kinds of things, including the ability to have the same ServerResource class provide different subsets of the uniform interface depending on the URI. I just don't understand *why* you would want to do this. You described two kinds of resource (corresponding to two URI patterns, /user/{id} and /user), one kind supporting GET, PUT, DELETE and the other kind supporting POST. You *can* use the same ServerResource implementation to handle both (by overriding default ServerResource behavior), but it's like throwing away polymorphism in OO programming and implementing everything in one class with switch statements: It doesn't buy you anything, and it will confuse people who read your code. But, leave this POST vs GET-PUT-DELETE argument. What about GET with > different set of arguments? Like GET by name and GET by identity? In the > native Restlet API all of the GETs are routed to the same method. The > developer has then to understand what kind of GET it is. Or, again, we need > to split our ServerResource. > It sounds like you're pushing against the constraints of the REST paradigm, which limit you to exposing at most one GET operation per resource. If you have both GET-by-name and GET-by-identity operations, you need to have two kinds of resource (if you want to be RESTful), which most naturally corresponds in Restlet to two ServerResource subclasses. This discussion makes me think that there are really folks who think that > the native Restlet API is more convenient than JAX-RS when it comes to > routing the incoming requests. What am I missing here? > Huh? This discussion didn't mention JAX-RS until you brought it up. And what do you mean by the "native Restlet API"? Your first post in this conversation mentions the @Get annotation from Restlet, and it doesn't mention the lower-level Restlet API or JAX-RS' @GET annotation. --tim ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2889936