Hi,

On 27.01.2010 09:22, Bertrand Delacretaz wrote:
> 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....


Actually, there is a FAQ entry for this problem [1].

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

I would suggest for this to be an extension to the SlingPostServlet (if
at all possible). There is an issue for this: SLING-1172 [2]

Any patches welcome ...

Regards
Felix

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

[1]
http://cwiki.apache.org/SLING/faq.html#FAQ-HowdoIcreateanodebypostingajsondocumenttoaURL%3F
[2] https://issues.apache.org/jira/browse/SLING-1172

Reply via email to