Hi Andy,

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....

Ok - as standard the SlingPostServlet expects incoming values as
request parameters, see
http://sling.apache.org/site/manipulating-content-the-slingpostservlet-servletspost.html
for docs.

>... 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....

That would be a way, you could register a servlet to handle POST
methods which contain JSON data, and use a JSON parser in there to get
to the data. We have a simple parser in the commons/json bundle, [1].

To register servlets see http://sling.apache.org/site/servlets.html

> ...Could that be done with an ESP file instead?..

Yes, scripts and servlets are equivalent.

-Bertrand

[1] 
https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/json/src/main/java/org/apache/sling/commons/json/JSONObject.java

Reply via email to