I am not sure what you know about Restlet, but what I have is certain resources mounted at certain uri's and yes there is a /users uri that maps to a Resource that returns a json array of user's. Performing a POST on /users will create a new user, PUTting against /users/{userId} will update the details of the user.... all of this is done through Restlet and backed by Hibernate.

So we already have a lot of the REST API available through this. This is all managed from within a javascript application that does ajax GET/PUT/POST/DELETE calls.

What I have done at present is to move all the restlet based api under /api (managed by a restlet servlet). But I would also like to be able to access the data from within Sling and use the same rendering methods etc.

I think that the ResourceProvider does this for GET's but I am unsure whether I could do the same for POST's etc.

Bertrand Delacretaz wrote:
On Wed, Jul 2, 2008 at 6:46 AM, Bryce Ewing <[EMAIL PROTECTED]> wrote:

...I was thinking that it may be that I should just mount the Restlet servlet
on certain root uri's, which will override sling... but then this data would
not be accessible through sling at all.  This may be a good short term
solution (and one that it would be good to be able to know how to do?)

Preferably I would like all of the data to be visible directly within sling....

I'm not sure if I understand exactly what you're after, is that something like

  GET /users -> served by Restlet
  GET /users.html -> served by Sling

If that's the case, the simplest way might be to create a front-end
servlet that implements this decision and forwards to the appropriate
servlet, to avoid having to hack the Sling or Restlet servlets.

Another approach, if you have an httpd front-end, would be to rewrite
URLs to redirect them to the appropriate backend.

-Bertrand

Reply via email to