Wednesday, 11 November 2015

What is Sling? How is it different from other web-development frameworks?

Apache Sling is RESTful framework to access a java content repository over http protocol.
It is a content driven framework that is it maps the incoming user request based on URI to the corresponding node in the content repository and depending on the type of the request(GET,POST, etc) executes the corresponding dynamic script.
For example -  consider a scenario where a user is hitting a US website products page and getting the details of product1.
The incoming URL request from user will be
www.mywebsite.com/products/product1.html
This would be mapped by the sling resource resolver to a node in the JCR
/content/mywebsite/us/products/product1
Now the Sling resource resolver will check the properties of this node and check the sling:resourceType property of this node, which will tell the script that will be used to render the content of this page.
For example if value of sling:resourceType property is /apps/mywebsite/products/GET/body.jsp
Then for all the incoming GET requests on the product1 node, the above script will be used to render the content.
The main advantages of sling are:

it maps the url directly to the content it is restful.

No comments :

Post a comment