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 70f178751 Add information about exporter options
70f178751 is described below
commit 70f1787514e3740a220c7e86d75652e3218d640f
Author: Konrad Windszus <[email protected]>
AuthorDate: Tue Dec 13 16:18:28 2022 +0100
Add information about exporter options
---
src/main/jbake/content/documentation/bundles/models.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/main/jbake/content/documentation/bundles/models.md
b/src/main/jbake/content/documentation/bundles/models.md
index f2904c457..43f745c09 100644
--- a/src/main/jbake/content/documentation/bundles/models.md
+++ b/src/main/jbake/content/documentation/bundles/models.md
@@ -610,7 +610,7 @@ programatically exported by calling the `ModelFactory`
method `exportModel()`. T
The exact semantics of the exporting will be determined by an implementation
of the `ModelExporter` service interface.
-Sling Models currently includes a single exporter, using the Jackson
framework, which is capable of serializing models as JSON or transforming them
to `java.util.Map` objects. It is included in a dedicated bundle with the
symbolic name
[`org.apache.sling.models.jacksonexporter`](https://github.com/apache/sling-org-apache-sling-models-jacksonexporter).
+Sling Models currently includes a single exporter, using the Jackson
framework, which is capable of serializing models as JSON or transforming them
to `java.util.Map` objects. It is included in a dedicated bundle with the
symbolic name
[`org.apache.sling.models.jacksonexporter`](https://github.com/apache/sling-org-apache-sling-models-jacksonexporter).
It supports the option key `tidy` (which will auto indent the returned JSON
for better readability)
In addition, model objects can have servlets automatically registered for
their resource type (if it is set) using the `@Exporter` annotation. For
example, a model class with the annotation
@@ -622,6 +622,7 @@ results in the registration of a servlet with the resource
type and extension sp
through the `@Exporter` annotation's `selector` attribute). When this servlet
is invoked, the `Resource` will be adapted to the
model, exported as a `java.lang.String` (via the named Exporter) and then
returned to the client. The `ExportServlet` only supports models for adaptable
`org.apache.sling.api.resource.Resource` or
`org.apache.sling.api.SlingHttpServletRequest`. If a model is adaptable from
both the `Resource` is used.
+The ExportServlet allows to pass options to the exporter either via additional
selectors (which just get the String value `"true"` in the used options map) or
via regular request parameters (which are added to the options map with the
given value or just with the String value `"true"` in case the request
parameter didn't carry a value).
# Registration of Sling Models classes via bnd plugin