![BlogImage.jpg](https://sourcedcode.com/storage/2019/12/features-registering-sling-servlets-768x424.jpg)
Abstract
Multiple Ways to Modify Content
As always in life there is more than one way to do it. So to modify content in Sling, you have multiple options, the Sling default POST Servlet also called the SlingPostServlet is one of them. This page is about how you can modify - create, modify, copy, move, delete, import - content through the SlingPostServlet. In addition it also explains how to extend the SlingPostServlet with new operations.
Quickstart: Creating Content
To create content you simply send an HTTP POST request using the path of the resource to store the content in and include the actual content as request parameters. So one possibility to do just that is by having an HTML Form like the following:
This simple form will set the title and text properties on a resource at /some/new/content. If this resource does not exist it is just created otherwise the existing content would be modified.
Similarly, you can do this using the curl command line tool:
$ curl -Ftitle="some title text" -Ftext="some body text content" http://host/some/new/content
You might want to set a specific Sling resource type using the sling:resourceType property:
$ curl -F"sling:resourceType=sling:sample" -Ftitle="some title text" \
-Ftext="some body text content" http://host/some/new/content
If you deal with a JCR repository you might want to set the node type (however using Sling resource type is the preferred way):
$ curl -F"jcr:primaryType=nt:unstructured" -Ftitle="some title text" \
-Ftext="some body text content" http://host/some/new/content
Similarly, you may assign JCR mixin node types using the jcr:mixinTypes property.
Read Full Blog
Q&A
Please use this thread to ask the related questions.
Kautuk Sahni