blank
blank

Reputation: 18180

In Restlet, what's the difference between a Restlet class and a Resource class?

I've gone through the firstResource bit of the Restlet 1.1 tutorial and put together a web service that handles GET, POST, DELETE, PUT by subclassing the Resource class and overriding the appropriate methods and using a Router to attach the subclassed Resource classes.

So I'm left thinking - what's the point of a Restlet?

What's the difference? When do I use one or the other? What would I put in a Restlet handle method?

Thanks.

Upvotes: 4

Views: 1233

Answers (1)

Wolfgang
Wolfgang

Reputation: 2407

Restlet is the base class for various restlet server facilities, among them Application and Router. When its handle() method is called it's supposed to interpret the request, dispatch it to a suitable child restlet or query the matching resource (the GET/POST/... handle methods), and put the result back in the response.

So, restlets and resources are nodes of a tree. Resources are the leafs of that tree.

Restlets usually don't answer to request but delegate them down the tree. Resources actually reply.

In general, you will program only custom resources and use pre-defined restlets.

Upvotes: 4

Related Questions