You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2015/03/15 21:47:57 UTC

svn commit: r1666841 - /sling/site/trunk/content/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.mdtext

Author: rombert
Date: Sun Mar 15 20:47:56 2015
New Revision: 1666841

URL: http://svn.apache.org/r1666841
Log:
SLING-4504 - SlingPostServlet documentation spelling errors and misaligned list

Submitted-By: Nate Yolles

Modified:
    sling/site/trunk/content/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.mdtext

Modified: sling/site/trunk/content/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.mdtext
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.mdtext?rev=1666841&r1=1666840&r2=1666841&view=diff
==============================================================================
--- sling/site/trunk/content/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.mdtext (original)
+++ sling/site/trunk/content/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.mdtext Sun Mar 15 20:47:56 2015
@@ -1,6 +1,5 @@
 Title: Manipulating Content - The SlingPostServlet (servlets.post)
 
-
 [TOC]
 
 
@@ -10,7 +9,7 @@ Title: Manipulating Content - The SlingP
 As always in life there is more than one way to do it. So to modify content in a JCR repository underlying Sling, you have multiple options, two of which are WebDAV and the Sling default POST Servlet also called the *SlingPostServlet*. 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.
 
 
-What is Content anyway ? In the following discussion, I use the terms *Content* and *Item* interchangeably. With *Content* I just mean some data to be stored in the JCR repository to be later used as the basis for some presentation. In this sense *Content* is a rather conceptual term. *Item* is the name of the parent interface of the JCR *Node* and *Property* interfaces. When speaking of *Items* we mean some actual data stored in the repository ignoring whether the data is actually stored as a *Node* with child nodes and properties or just a single *Property*.
+What is Content anyway? In the following discussion, I use the terms *Content* and *Item* interchangeably. With *Content* I just mean some data to be stored in the JCR repository to be later used as the basis for some presentation. In this sense *Content* is a rather conceptual term. *Item* is the name of the parent interface of the JCR *Node* and *Property* interfaces. When speaking of *Items* we mean some actual data stored in the repository ignoring whether the data is actually stored as a *Node* with child nodes and properties or just a single *Property*.
 
 
 ## Quickstart: Creating Content
@@ -28,21 +27,21 @@ To create content you simply send an HTT
 
 This simple form will set the `title` and `text` properties on a node at `/some/new/content`. If this node 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:
+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 use a specific JCR node type for a newly created node. This is possibly by simply setting a `jcr:primaryType` property on the request, e.g.
+You might want to use a specific JCR node type for a newly created node. This is possible by simply setting a `jcr:primaryType` property on the request, e.g.
 
 
     $ curl -F"jcr:primaryType=nt:unstructured" -Ftitle="some title text" \    
         -Ftext="some body text content" http://host/some/new/content
 
 
-Similary you may assing JCR mixin node types using the `jcr:mixinTypes` property and a Sling resource type using the `sling:resourceType` property. For example:
+Similarly, you may assign JCR mixin node types using the `jcr:mixinTypes` property and a Sling resource type using the `sling:resourceType` property. For example:
 
 
     $ curl -F"sling:resourceType=sling:sample" -Ftitle="some title text" \    
@@ -54,14 +53,14 @@ Similary you may assing JCR mixin node t
 
 Sometimes you might want to have the content modifications applied in a certain order. This is particularly interesting if you use fields to create child nodes and if you want to stipulate a certain child node order based on the form fields.
 
-In this case ensure you are submitting the POST request using `multipart/form-data` encoding. This preserves the order of parameter application according to the original HTML form. To this avail ensure to always include the `enctype="multipart/form-data"` attribute with the `<form>` tag.
+In this case, ensure you are submitting the POST request using `multipart/form-data` encoding. This preserves the order of parameter application according to the original HTML form. To this avail, ensure to always include the `enctype="multipart/form-data"` attribute with the `<form>` tag.
 
 This support requires Sling Engine 2.1.0 and the Sling Default Post Servlet 2.0.6.
 
 
 ## SlingPostServlet Operations
 
-The SlingPostServlet is actually just a frontend to the actual operations. To select the actual operation to execute, the `:operation` request parameter is used. Out of the box, the SlingPostServlet supports the following operations:
+The SlingPostServlet is actually just a front-end to the actual operations. To select the actual operation to execute, the `:operation` request parameter is used. Out of the box, the SlingPostServlet supports the following operations:
 
    * property not set or empty -- Create new content or modify existing content
    * `delete` -- Remove existing content
@@ -131,7 +130,7 @@ Here is another example show a simple HT
     </form>
 
     
-If this form is submitted with *title* and *This is some Text* as values for the `title` and `text` fields, resp., a new node is created at the path `/content/page/first` and the `title` and `text` properties set to the respective field values. If a node at `/content/page/first` already existed before submitting the form, the `title` and `text` properties are just updated to the new values from the form fields.
+If this form is submitted with *title* and *This is some Text* as values for the `title` and `text` fields respectively, a new node is created at the path `/content/page/first` and the `title` and `text` properties set to the respective field values. If a node at `/content/page/first` already existed before submitting the form, the `title` and `text` properties are just updated to the new values from the form fields.
     
 If a parameter has multiple values, the respective property will be created as a multi-value property. So for example the command line:
     
@@ -188,7 +187,7 @@ Parameters providing date/time values to
     
 The Sling Post Servlet configuration property `servlet.post.dateFormats` takes a list of format strings which are used to setup `java.text.SimpleDateFormat` instances for parsing date/time string representations. A special format string `ISO8601` is supported to indicate the string to be parsed as a JCR standard string representation of a _Date_ property.
     
-The default list of configured date/time parse pattern is :
+The default list of configured date/time parse pattern is:
     
 * EEE MMM dd yyyy HH:mm:ss 'GMT'Z
 * ISO8601, using the org.apache.jackrabbit.util.ISO8601 parser (±YYYY-MM-DDThh:mm:ss.SSSTZD)
@@ -204,7 +203,7 @@ Any date/time string parameter supplied
     
 ##### Omitting Some Parameters
     
-There may be times, that you have forms which contain a lot of fields, which you do not want to actually store in content. Such forms usually are created using some client-side GUI library which uses the fields for its own purposes. To be able to easily differentiate between real content to be actually stored and such control parameters, you may prefix the names of the fields destined for content with a dot-slash (`./`).
+There may be times that you have forms which contain a lot of fields which you do not want to actually store in content. Such forms usually are created using some client-side GUI library which uses the fields for its own purposes. To be able to easily differentiate between real content to be actually stored and such control parameters, you may prefix the names of the fields destined for content with a dot-slash (`./`).
     
 As soon as the SlingPostServlet encounters parameters prefixed with dot-slash, only those parameters are considered for content updates while all other parameters not prefixed are just ignored. In addition to dot-slash prefixed parameters, also parameters prefixed with dot-dot-slash (`../`) and slash (`/`) are considered in this situation.
     
@@ -246,7 +245,7 @@ For example, the parameter `width@TypeHi
 
 Parameters with the `@TypeHint` suffix may be used to force storing the named parameter in a property with the given type. The value of the `@TypeHint` parameter, if applied to a parameter for a property, is the JCR property type name. If the `@TypeHint` parameter is applied to a field upload parameter, the value is used to indicate the JCR primary node type for the node into which the uploaded file is stored.
 
-If the `@TypeHint` value ends with `[]`, it indicates a multi-value property. A multi-value property is usually auto-detected if there are mutliple values for the property (ie. request parameter). But if only a single value is present in the request, the desired property type needs to be explicitly defined as multi-value by stating `@TypeHint=<type>[]`.
+If the `@TypeHint` value ends with `[]`, it indicates a multi-value property. A multi-value property is usually auto-detected if there are multiple values for the property (i.e. request parameter). But if only a single value is present in the request, the desired property type needs to be explicitly defined as multi-value by stating `@TypeHint=<type>[]`.
 
 Example: The following form sets the numeric `width`, the boolean `checked`, and the multi-valued `hobbys` (with 3 values to enter) properties:
 
@@ -263,7 +262,7 @@ Example: The following form sets the num
     </form>
 
     
-In real applications you would need some javascript that allows to add/remove values, ie. add/remove inputs with the name "hobbys". Or a pure javascript based form post would be used, that gathers the properties to update programmatically, but the additional parameter `hobbys@TypeHint=String[]` would be the same.
+In real applications you would need some JavaScript that allows to add/remove values, ie. add/remove inputs with the name "hobbys". Or a pure JavaScript based form post would be used, that gathers the properties to update programmatically, but the additional parameter `hobbys@TypeHint=String[]` would be the same.
     
 The `@TypeHint` suffixed parameter is assumed to be single-valued. If the parameter has multiple values, only the first is actually used.
 
@@ -345,7 +344,7 @@ Example: To set the property `text` from
     </form>
 
     
-To prevent storing the additional paramaters in the repository you might want to use the prefixing mechanism as shown in the example above, where the `@ValueFrom` parameter is prefixed and thus the `supplied_text` parameter is not used for property setting.
+To prevent storing the additional parameters in the repository you might want to use the prefixing mechanism as shown in the example above, where the `@ValueFrom` parameter is prefixed and thus the `supplied_text` parameter is not used for property setting.
     
 The `@ValueFrom` suffixed parameter is assumed to be single-valued. If the parameter has multiple values it is ignored completely.
     
@@ -371,7 +370,7 @@ Example: To ensure the `color` property
 
 The `@Delete` suffixed parameter is also special in that there need not be a correlated parameter without a suffix. If both -- a parameters `text` and `text@Delete` are set, the `text` property is first deleted and then filled with the new content.
 
-The `@Delete` suffixed parameter in fact calls for a sub-operation, which is executed after the node addressed by the request URL is created (if needed) but before any other tasks of content creattion and modification are done. Any item -- this may be a property or a node, actually -- addressed by the `@Delete` suffixed parameter is just removed if it exists. If the item does not exist, nothing happens.
+The `@Delete` suffixed parameter in fact calls for a sub-operation, which is executed after the node addressed by the request URL is created (if needed) but before any other tasks of content creation and modification are done. Any item -- this may be a property or a node, actually -- addressed by the `@Delete` suffixed parameter is just removed if it exists. If the item does not exist, nothing happens.
 
 
 
@@ -398,7 +397,7 @@ The `@MoveFrom` suffixed parameter is as
     
 The `@MoveFrom` suffixed parameter is also special in that there must not be a correlated parameter without a suffix. Thus have parameters `text` and `text@MoveFrom` may have unexpected results.
     
-The `@MoveFrom` suffixed parameter in fact calls for a sub-operation, which is executed after the `@Delete` sub operation but before any other tasks of content creattion and modification are done.
+The `@MoveFrom` suffixed parameter in fact calls for a sub-operation, which is executed after the `@Delete` sub operation but before any other tasks of content creation and modification are done.
     
     
 ###### `@CopyFrom`
@@ -438,13 +437,13 @@ For example, imagine a multi-value strin
         <input type="Submit" />
     </form>
     
-The array will be treated like a set: when adding a value, it will only be added once if it does not exist yet; when removing a value, all occurences of it will be removed. For values not affected by the add or remove operations, nothing changes. An existing array with duplicate entries will not automatically be converted into a set.
+The array will be treated like a set: when adding a value, it will only be added once if it does not exist yet; when removing a value, all occurrences of it will be removed. For values not affected by the add or remove operations, nothing changes. An existing array with duplicate entries will not automatically be converted into a set.
 
 The format for an individual parameter value is `<operation><value>`. If there is no or no valid operation given, this value will be ignored.
 
 Operation `+` will add the `<value>` to the array if it is not part of it yet.
 
-Operation `-` will remove all occurences of `<value>` from the array.
+Operation `-` will remove all occurrences of `<value>` from the array.
 
 The value of the `@Patch` suffixed parameter is irrelevant, it can be empty (example above uses `true` for clarity).
 
@@ -458,7 +457,7 @@ If request is posted with an URL ending
 
 1. If a `:name` parameter is supplied, the (first) value of this parameter is used unmodified as the name for the new node. If the name is illegally formed with respect to JCR name requirements, an exception will be thrown when trying to create the node. The assumption with the `:name` parameter is, that the caller knows what he (or she) is supplying and should get the exact result if possible.
 1. Otherwise if a `:nameHint` parameter is supplied, the (first) value of this parameter is used to generate the node name. A name filtering is applied to this hint to ensure a valid JCR node name.
-1. Otherwise a series of request paramaters supplied to set content is inspected for a possible name. The list of the names of these parameter is configurable with the SlingPostServlet and defaults ot `[ title, jcr:title, name, description, jcr:description, abstract ](` refs.-title-jcr-title-name-description-jcr-description-abstract.path `)`. The first request parameter with a non-empty value is used and filtered to get the valid JCR name.
+1. Otherwise a series of request parameters supplied to set content is inspected for a possible name. The list of the names of these parameter is configurable with the SlingPostServlet and defaults to `[ title, jcr:title, name, description, jcr:description, abstract ](` refs.-title-jcr-title-name-description-jcr-description-abstract.path `)`. The first request parameter with a non-empty value is used and filtered to get the valid JCR name.
 1. Otherwise an ever increasing auto generated number is used. Filtering is also applied to this numeric name.
 
 
@@ -501,7 +500,7 @@ The delete operation has the following s
 
 | Status | Explanation |
 |--|--|
-| 200/OK | The resource (and all its descendents) has been removed |
+| 200/OK | The resource (and all its descendants) has been removed |
 | 404/NOT FOUND | The request URL does not address an existing repository item |
 | 500/INTERNAL SERVER ERROR | Some exception, for example a `RepositoryException`, occurred while processing the request |
 
@@ -805,7 +804,7 @@ does the trick. To be redirected after t
 
 ### `:redirect`
 
-Instructs the SlingPostServlet to redirect the client to the indicated location if the operation succeeds. That is the reponse status is set to *302/FOUND* and the `Location` header is set to the value of the `:redirect` parameter.
+Instructs the SlingPostServlet to redirect the client to the indicated location if the operation succeeds. That is the response status is set to *302/FOUND* and the `Location` header is set to the value of the `:redirect` parameter.
 
 
 ### `:status`
@@ -823,6 +822,7 @@ The format of this response is either HT
 The Accept header can be overridden (and simulated) by posting a :http-equiv-accept field, which should have the same format as the Accept header.
 
 Examples:
+
 1. Accept: text/html,application/xhtml+xml,application/xml;q=0.9,**/**;q=0.8
 1. Accept: application/json,**/**;q=0.9