You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2018/07/10 09:43:57 UTC

[sling-site] branch master updated: clarify restriction on the rewriter pipelines

This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-site.git


The following commit(s) were added to refs/heads/master by this push:
     new 3983669  clarify restriction on the rewriter pipelines
3983669 is described below

commit 39836691babe8c16fa5b7ce6d210cfb077a494a7
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Tue Jul 10 11:43:51 2018 +0200

    clarify restriction on the rewriter pipelines
---
 ...ewriting-pipelines-org-apache-sling-rewriter.md | 53 ++++++++++------------
 1 file changed, 24 insertions(+), 29 deletions(-)

diff --git a/src/main/jbake/content/documentation/bundles/output-rewriting-pipelines-org-apache-sling-rewriter.md b/src/main/jbake/content/documentation/bundles/output-rewriting-pipelines-org-apache-sling-rewriter.md
index dd95ac6..a23dbe5 100644
--- a/src/main/jbake/content/documentation/bundles/output-rewriting-pipelines-org-apache-sling-rewriter.md
+++ b/src/main/jbake/content/documentation/bundles/output-rewriting-pipelines-org-apache-sling-rewriter.md
@@ -20,24 +20,7 @@ Between the generator and the serializer so called transformers can be placed in
 
 Sling contains a default pipeline which is executed for all HTML responses: it starts with an HTML generator, parsing the HTML output and sending events into the pipeline. An HTML serializer collects all events and serializes the output. 
 
-The pipelines can be configured in the repository as a child node of */apps/APPNAME/config/rewriter* (or */libs/APPNAME/config/rewriter*). (In fact the configured search paths of the resource resolver are observed.) Each node can have the following properties:
-
-* generatorType - the type of the generator (required)
-* transformerTypes (multi value string) - the types of the transformers (optional)
-* serializerType - the type of the serializer (required)
-* paths (multi value string) - the paths this pipeline should run on (content paths)
-* contentTypes (multi value string) - the content types this pipeline should be used for (optional)
-* extensions (multi value string) - the extensions this pipeline should be used for (optional)
-* resourceTypes (multi value string) - the resource types this pipeline should be used for (optional)
-* unwrapResources (boolean) - check resource types of unwrapped resources as well (optional, since 1.1.0)
-* selectors (multi value string) - a set of selectors the pipeline should be used for (optional, since 1.1.0)
-* order (long) - the configurations are sorted by this order, order must be higher or equal to 0. The configuration with the highest order is tried first.
-* enabled (boolean) - Is this configuration active? (default yes)
-
-As you can see from the configuration there are several possibilities to define when a pipeline should be used for a response, like paths, extensions, content types, or resource types. It is possible to specify several of them at once. In this case all conditions must be met.
-
-If a component needs a configuration, the configuration is stored in a child node which name is *\{componentType\}\-\{name\}*, e.g. to configure the HTML generator (named *html\-generator*), the node should have the name *generator-html-generator*. In the case that the pipeline contains the same transformer several times, the configuration child node should have the formant *\{componentType\}-\{index\}* where index is the index of the transformer starting with 1. For example if you have  [...]
-
+You can overwrite the configuration or contribute more specific configurations as outlined below in [Configuring a Processor](#configuring-a-processor). Only one pipeline is being picked based on the matching configuration with the highest order.
 
 ### Default Pipeline
 
@@ -87,14 +70,26 @@ Like the pipeline components a processor is generated by a factory which has to
 
 ## Configuring a Processor
 
-The processors can be configured in the repository as a child node of */apps/APPNAME/config/rewriter* (or libs or any configured search path). Each node can have the following properties:
-
-* processorType - the type of the processor (required) - this is the part from the scr factory information after the slash (in the example above this is *uniqueName*)
-* paths (multi value string) - the paths this processor should run on (content paths)
-* contentTypes (multi value string) - the content types this processor should be used for (optional)
-* extensions (multi value string) - the extensions this processor should be used for (optional)
-* resourceTypes (multi value string) - the resource types this processor should be used for (optional)
-* unwrapResources (boolean) - check resource types of unwrapped resources as well (optional, since 1.1.0)
-* selectors (multi value string) - a set of selectors the pipeline should be used for (optional, since 1.1.0)
-* order (long) - the configurations are sorted by this order, order must be higher or equal to 0. The configuration with the highest order is tried first.
-* enabled (boolean) - Is this configuration active? (default yes)
+The pipelines can be configured in the repository as a child resource of 
+`/apps/<APPNAME>/config/rewriter/*` (or `/libs/<APPNAME>/config/rewriter/*`).
+ (In fact the configured search paths of the resource resolver are observed.) Each resource can have the following properties:
+
+Property | Type | Description | Example Value | Mandatory 
+--- | --- | --- | --- | ---
+`generatorType` | String | The type of the generator. Identifies the generator being registered via service property `pipeline.type` of a service implementing a `GeneratorFactory` | `html-generator` | yes
+`transformerTypes` | String[] | The types of the transformers. Identifies the transformers being registered via service property `pipeline.type` of a service implementing a `TransformerFactory` |  `link-rewriter` (Sling itself does not contain any TransformerFactories) | no
+`serializerType` | String |  The type of the serializer. Identifies the serializer being registered via service property `pipeline.type` of a service implementing a `SerializerFactory` | `html-serializer` | yes
+`paths` | String[] | The paths this pipeline should run on (content paths). Only if the request's resource path starts with one of the given `paths` or one of the given paths is `*` the pipeline configuration is considered. | `/content/` | no
+`contentTypes` | String[] | The content types this pipeline should be used for . If no explicit content type is set on the response yet, `text/html` is assumed. May contain `*` values which match for all content types. Only if the response has one of the given content types the pipeline configuration is considered. | `text/html` | no
+`extensions` | String | The extensions this pipeline should be used for. Only if the request's extension is equal to one of the given extensions the pipeline configuration is considered. | `html` | no
+`resourceTypes` | String[] | The resource types this pipeline should be used for. Only if the request's resource type is equal (via `ResourceResolver.isResourceType(<request's resource>, <given resource type>`) to one of the given resourceTypes the pipeline configuration is considered. | `myapp/customresourcetype` | no
+`unwrapResources` | Boolean | Check resource types of unwrapped resources as well if this is set to `true`. Available since 1.1.0 ([SLING-5012](https://issues.apache.org/jira/browse/SLING-5012)). | `false` | no
+`selectors` | String[] | A set of selectors the pipeline should be used for. Each value is a single selector (i.e. must not contain `.`). Only if the request contains at least one selector which is equal to one of the given selectors, this pipeline configuration is considered. Available since 1.1.0 ([SLING-3511](https://issues.apache.org/jira/browse/SLING-3511)) | `myselector` | no
+`order` | Long | The configurations are sorted by this order, order must be higher or equal to 0. The configuration with the highest order is tried first.  Default value (if not set): 0 | 100 | no
+`enabled` | Boolean | Is this configuration active? (default yes) | `false` | no
+`processError` | Boolean | Only if this is set to `true` also error responses are processed by this pipeline configuration. Default `true` | `true` | no
+
+As you can see from the configuration there are several possibilities to define when a pipeline should be used for a response, like paths, extensions, content types, or resource types. It is possible to specify several of them at once. In this case all conditions must be met.
+
+If a component needs a configuration, the configuration is stored in a child node which name is *\{componentType\}\-\{name\}*, e.g. to configure the HTML generator (named *html\-generator*), the node should have the name *generator-html-generator*. In the case that the pipeline contains the same transformer several times, the configuration child node should have the formant *\{componentType\}-\{index\}* where index is the index of the transformer starting with 1. For example if you have  [...]
+