Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-04-12 Thread beaudet
Lance, we are trying to do something similar. We have an enterprise DAM and would like to extend Adobe AEM 6.2 to enable the native AEM DAM UI widgets to work with those remote assets in addition to native AEM assets. We would also like to enable search of those digital assets via the AEM

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-02-01 Thread Bertrand Delacretaz
Hi Lance, On Tue, Jan 31, 2017 at 10:25 PM, lancedolan wrote: > Aha! Solved Here's my solution for posterity thanks for sharing! Note that (and maybe I should have tried that earlier, sorry) you can also use our planets resource example on Sling 8 by building it

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-31 Thread Henry Saginor
Oh you beat to it.:) I had a similar approach for aggregating page specific JavaScript via a fake resource and was going to provide a skeleton of it. But I am glad you got it to work. I want to add that Sling could probably benefit from Jersey-like ability to generate web services from simple

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-31 Thread Henry Saginor
I apologize. I think I missed the “serving up large number of virtual resources” part of your requirements. You can use JCR nodes just to create resources that map to your resource type and still get your data from anywhere. But if resource path itself needs to be dynamic or it’s difficult to

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-31 Thread lancedolan
Aha! Solved Here's my solution for posterity. While Jersey would have been a preferred, more feature-rich solution, I just couldn't get the OSGI-Jersey stuff working. The solution: - ResourceProvider listens for all requests to a particular path, and returns a false "Resource" object,

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-31 Thread lancedolan
Henry Saginor-2 wrote > Hi Lance, > > I think a better practice is to register your servlet with a resource type > instead of path. This requires creating a node per resource. Please see my prior post where I disqualify all solutions that involve creating nodes. My entire requirement is that I'm

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-30 Thread lancedolan
I guess, even if we use SlingSafeMethodsServlet and request parameter, I still have this problem of securing the servlet... I've put a servlet at paths = "/myservice/image" , and created a node at /myservice with an ACL that denies jcr: all to everyone and anonymous, and yet anonymous can still

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-30 Thread lancedolan
I'm surprised at all the tech opinions this raised :) First, there's a couple popular suggestions happening which aren't going in the right direction, so I'll get that out of the way quick: 1) Any solution that involves me creating a JCR node and binding by resource type is infeasible. I'm not

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-30 Thread Bertrand Delacretaz
Hi Lance, On Fri, Jan 27, 2017 at 10:27 PM, lancedolan wrote: > ...Bertrand suggests creating a ResourceProvider, as in the example here [1]. > However, that uses the spi package which is not in version 2.9.0 of > org.apache.sling.api, and thus, not available to me in

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-30 Thread Robert Munteanu
Hi, On Fri, 2017-01-27 at 14:27 -0700, lancedolan wrote: > Hi friends, > > I've tried routing questions through stackoverflow to cut down my > mails to > this list. I'm losing lots of time on this one, though, and am stuck. > > I need to create APIs which don't represent Sling Resources.

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-29 Thread Ben Fortuna
Hi Jason, Possibly I approached it from the wrong angle in my assessment, happy to hear it's been working for you and others. I may try again for APIs in future. That aside, after using sling for serving web content I can't recommend it enough. For me it certainly puts the fun back in web

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-29 Thread Jason E Bailey
I'm not sure how to correctly convey my confusion over your statement :) There may be some bias here, since I've been doing this for a while, but this is an incredibly easy platform for REST and I haven't ran across another that gives me the same flexibility. -- Jason On Sat, Jan 28, 2017, at

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-29 Thread Jason E Bailey
In general I agree with you, that's the simplest OP had a dual need. which is storing information about the asset in the JCR at the same time, which I don't see how your solution handles. -- Jason On Sat, Jan 28, 2017, at 02:08 PM, Henry Saginor wrote: > In my opinion Sling is first and

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-29 Thread Ben Fortuna
Hi Roy, Yes my reference to data/content was based on the OP stating he'll be storing data in JCR, so effectively yes he probably could just use a JCR repo backend. I'm not totally discounting Sling as an API platform, just that it probably won't integrate easily with other API frameworks (e.g.

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-28 Thread Ben Fortuna
Hi Henry, I agree with what you say about keeping it simple and using a servlet. However there are many frameworks and platforms today geared towards making it easier to implement REST APIs, and I think non-trivial APIs would probably benefit from using one. As such, to me an API should live

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-28 Thread Henry Saginor
In my opinion Sling is first and foremost a REST framework specifically designed for this kind of thing. It’s not only to serve JCR content. The paradigm Steven described earlier in this thread is EXACTLY the way to implement it. In the Sling world the resource IS the RESTful object addressable

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-28 Thread Jason E Bailey
Its my understanding that the question on ACL's depends on where it is inheriting the ACL from. Taking your code as literal, you've declared that you own everything under /things and it would inherit the ACL of /. So if you put your ROOT as /content/remote/things You could set JCR ACLs on

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-28 Thread Roy Teeuwen
Hey Oli, Isnt that the whiteboard that I gave? https://github.com/apache/aries-jax-rs-whiteboard Greets Roy > On 28 Jan 2017, at 09:43, olimination wrote: > > Hi Lance, > > as Mike already mentioned the "Neba

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-28 Thread olimination
Hi Lance, as Mike already mentioned the "Neba framework" offers you the full Spring power, meaning you can easily write Spring controllers which then for example inject your needed OSGi services and you then do whatever you need to do plus you have access to all the possibilities Spring offers

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-27 Thread Henry Saginor
Can’t you just create sling servlet registered to some resource type? You can then simply create JCR node(s) mapped to your resource type. You can also use a SynthaticResource via custom resource provider, which is the track you’re on and what Steven is suggesting. But I find that in most

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-27 Thread Steven Walters
On Sat, Jan 28, 2017 at 6:27 AM, lancedolan wrote: > Hi friends, > > I've tried routing questions through stackoverflow to cut down my mails to > this list. I'm losing lots of time on this one, though, and am stuck. > > I need to create APIs which don't represent Sling

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-27 Thread Mike Nimer
Check out http://neba.io/ it should do what you need with Spring instead of Jersey. hope this helps --mike On Fri, Jan 27, 2017 at 3:27 PM, lancedolan wrote: > Hi friends, > > I've tried routing questions through stackoverflow to cut down my mails to > this list. I'm

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-27 Thread Andreas Schaefer Sr.
I never develop for Sling but a few years doing backend on AEM. So I am wondering if you used the Sling IDE Tooling (Eclipse or our IntelliJ Plugin) and debugged your code there. Did you try to use a Servlet that is bound to a Type instead of a Path? This might do what you want. Cheers - Andy

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-27 Thread Roy Teeuwen
Hey Lance, If you really want to use jax-rs, have a look at the following: https://github.com/apache/aries-jax-rs-whiteboard Greets, Roy > On 27 Jan 2017, at 23:29, lancedolan wrote: > > These APIs I'm looking to

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-27 Thread lancedolan
These APIs I'm looking to build are likely to use other OSGI services I've written, and perhaps even write to the JCR for other reasons. Imagine doing a GET /api/images/my-new-image.jpg and the image lives in Amazon S3, but you want to write some audit data into the JCR. I'm still thinking

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-27 Thread Ben Fortuna
Hi Lance, I would personally recommend that you find a different solution for serving REST APIs. I also thought it might be good to service an API from Sling, as it does make JSON a "first class citizen", but then I realised that Sling is geared towards serving resources from JCR and ultimately