>> On Tue, Jan 26, 2010 at 6:07 PM, Andreas Schaefer <[email protected]> wrote: >>> To see if Sling would fit our project I would need to be able to handle >>> calls from a client (Ext/JS) >>> sending JSon to server and expecting a JSon response back....
Ah, sorry, I missed the *sending* JSON part ... which was kind of important. >>> ... In the samples I read that it is possible to register a servlet inside >>> Sling but I am not quite sure >>> how to do it.... > On 27.01.2010 09:22, Bertrand Delacretaz wrote: >> That would be a way, you could register a servlet to handle POST >> methods [...] The problem with this is that your SlingPostOperations and SlingPostProcessors won't be executed - those are handled by the default SlingPostServlet, which returns HTML. If you don't need postoperations and postprocessors in your case, then this is not an issue. It would be nice if there was a way to get JSON output from the standard SlngPostServlet, so that way we could leverage current SlingPostOperations. I have looked into it briefly. The HtmlResponse object that is passed to SlingPostOperations is a bit of a turn-off in this sense, but AFAICT only HtmlResponse.send() actually produces HTML. We could abstract HtmlResponse to some output-agnostic Response object, and then let SlingPostServlet decide (how?) which output format to return. -- Vidar S. Ramdal <[email protected]> - http://www.idium.no Sommerrogata 13-15, N-0255 Oslo, Norway + 47 22 00 84 00 / +47 21 531941, ext 2070
