https://github.com/davidjgonzalez/com.activecq.samples/blob/master/core/src/main/java/com/activecq/samples/resourcedecorators/impl/SampleResourceTypeResourceDecorator.java
On Wednesday, November 12, 2014, Bruce Edge <[email protected]> wrote: > That sounds pretty close to ideal. > > <noob warning> > Is there any sample/contrib code I could use as a starting point to create > an osgi bundle that adds a ResourceDecorator? > > > -Bruce > > From: Sarwar Bhuiyan <[email protected] <javascript:;><mailto: > [email protected] <javascript:;>>> > Reply-To: "[email protected] <javascript:;><mailto: > [email protected] <javascript:;>>" <[email protected] > <javascript:;><mailto:[email protected] <javascript:;>>> > Date: Wednesday, November 12, 2014 at 10:57 AM > To: "[email protected] <javascript:;><mailto:[email protected] > <javascript:;>>" <[email protected] <javascript:;><mailto: > [email protected] <javascript:;>>> > Subject: Re: HATEOAS compliant json self/child references from sling? > > Maybe using a ResourceDecorator which inspects each resource and injects > the HAL or whatever properties into the resource before rendering. The > default get servlet may or may not render it accordingly but if you've got > your own selector you can pretty much enhance your output however you like > since href can just be generated from resource.getPath() > > That might not be what you're looking for but it will require a little bit > of code > > On Wednesday, November 12, 2014, Bruce Edge <[email protected] > <javascript:;><mailto:[email protected] <javascript:;>>> > wrote: > > Can one retrieve HATEOAS format responses form sling? > > %> curl -qu admin:admin http://localhost:8090/var/content.tidy.json > { > "jcr:createdBy": "admin", > "jcr:mimeType": "application/octet-stream", > "jcr:created": "Sat Nov 08 2014 16:17:51 GMT-0800", > "jcr:lastModified": "Sat Nov 08 2014 16:17:51 GMT-0800", > "jcr:primaryType": "sling:Folder" > } > > Using a HATEOAS server I would expect something like this: > { > "jcr:createdBy": "admin", > "jcr:mimeType": "application/octet-stream", > "jcr:created": "Sat Nov 08 2014 16:17:51 GMT-0800", > "jcr:lastModified": "Sat Nov 08 2014 16:17:51 GMT-0800", > "jcr:primaryType": ³sling:Folder" > "_links":{ > "self":{ > "href":"http://localhost:8090/var/content" > } > } > } > > Is it possible to have sling insert both self and child references into > all json responses? > > -Bruce > > > >
