You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2017/06/19 12:41:20 UTC
[14/53] sling-site git commit: asf-site branch created for published
content
http://git-wip-us.apache.org/repos/asf/sling-site/blob/7b703652/content/documentation/the-sling-engine/service-authentication.md
----------------------------------------------------------------------
diff --git a/content/documentation/the-sling-engine/service-authentication.md b/content/documentation/the-sling-engine/service-authentication.md
deleted file mode 100644
index be77891..0000000
--- a/content/documentation/the-sling-engine/service-authentication.md
+++ /dev/null
@@ -1,255 +0,0 @@
-title=Service Authentication
-type=page
-status=published
-~~~~~~
-Excerpt: Introduce new service level authentication to replace `loginAdministrative`
-
-[TOC]
-
-## Problem
-
-To access the data storage in the Resource Tree and/or the JCR Repository
-authentication is required to properly setup access control and guard
-sensitive data from unauthorized access. For regular request processing
-this authentication step is handled by the Sling
-[{{ refs.authentication.headers.title }}](/documentation/the-sling-engine/authentication.html)
-subsystem.
-
-On the other hand there are also some background tasks to be executed
-with access to the resources. Such tasks cannot in general be configured
-with user names and passwords: Neither hard coding the passwords in the code
-nor having the passwords in – more or less – plain text in some
-configuration is considered good practice.
-
-To solve this problem for services to identify themselves and authenticate
-with special users properly configured to support those services.
-
-The solution presented here serves the following goals:
-
-* Prevent over-use and abuse of administrative ResourceResolvers and/ro JCR Sessions
-* Allow services access to ResourceResolvers and/or JCR Sessions without
-requiring to hard-code or configure passwords
-* Allow services to use *service users* which have been specially
-configured for service level access (as is usually done on unixish systems)
-* Allow administrators to configure the assignment of service users to
-services
-
-
-## Concept
-
-A *Service* is a piece or collection of functionality. Examples of services
-are the Sling queuing system, Tenant Administration, or some Message Transfer
-System. Each service is identified by a unique *Service Name*. Since a
-service will be implemented in an OSGi bundle (or a collection of OSGi
-bundles), services are named by the bundles providing them.
-
-A Service may be comprised of multiple parts, so each part of the
-service may be further identified by a *Subservice Name*. This
-Subservice Name is optional, though. Examples of *Subservice Name*
-are names for subsystems in a Message Transfer System such as accepting
-messages, queueing messages, delivering messages.
-
-Ultimately, the combination of the *Service Name* and *Subservice Name*
-defines the *Service ID*. It is the *Service ID* which is finally mapped to
-a Resource Resolver and/or JCR Repository user ID for authentication.
-
-Thus the actual service identification (service ID) is defined as:
-
-#!text
-service-id = service-name [ ":" subservice-name ] .
-
-The `service-name` is the symbolic name of the bundle providing the service.
-
-
-### Example: Tenant Administration
-
-Tenant Administration mostly deals with creating and managing groups
-and some other user administration tasks. Instead of just using an
-administrative session for Tenant administration this feature could
-define itself as being the `tenant-admin` service and leverage a
-properly configured Tenant Administration account.
-
-### Example: Mail Transfer System
-
-Consider a Mail Transfer System which may be comprised of the following
-sub systems:
-
-* Accepting mail for processing — for example the SMTP server daemon
-* Queing and processing the messages
-* Delivering messages to mailboxes
-
-You could conceive that all these functions serve different purposes and
-thus should have different access rights to the repository to persist
-messages while they are being processed.
-
-Using the Service Authentication framework, the Mail Transfer System
-would be consituting the `mta` service. The sub systems would be called
-`smtp`, `queue`, and `deliver`.
-
-Thus the SMTP server daemon would be represented by a user for the
-`mta:smtp` Service. queueing with `mta:queue`, and delivery with `mta:deliver`.
-
-
-## Implementation
-
-The implementation in Sling of the *Service Authentication* concept
-described above consists of three parts:
-
-### `ServiceUserMapper`
-
-The first part is a new OSGi Service `ServiceUserMapper`. The
-`ServiceUserMapper` service allows for mapping *Service IDs* comprised of
-the *Service Names* defined by the providing bundles and optional *Subservice Name*
-to ResourceResolver and/or JCR Repository user IDs. This mapping is configurable
-such that system administrators are in full control of assigning users to services.
-
-The `ServiceUserMapper` defines the following API:
-
-#!java
-String getServiceUserID(Bundle bundle, String subServiceName);
-
-The implementation uses two fallbacks in case no mapping can be found for the given subServiceName
-
-1. Use user mapping for the serviceName only (not considering subServiceName)
-1. Use default user (if one is configured).
-
-In addition a service named `ServiceUserMapped` is registered for each bundle and subservice name for which a service user mapping is configured ([SLING-4312](https://issues.apache.org/jira/browse/SLING-4312)). By explicitly defining a (static) reference towards `ServiceUserMapped` one can defer starting the service until that service user mapping is available.
-
-### `ResourceResolverFactory`
-
-The second part is support for service access to the Resource Tree. To this
-avail, the `ResourceResolverFactory` service is enhanced with a new factory
-method
-
-#!java
-ResourceResolver getServiceResourceResolver(Map<String, Object> authenticationInfo)
-throws LoginException;
-
-This method allows for access to the resource tree for services where the
-service bundle is the bundle actually using the `ResourceResolverFactory`
-service. The optional Subservice Name may be provided as an entry
-in the `authenticationInfo` map.
-
-In addition to having new API on the `ResourceResolverFactory` service to
-be used by services, the `ResourceProviderFactory` service is updated
-with support for Service Authentication: Now new API is required, though
-but additional properties are defined to convey the service to authenticate
-for.
-
-The default implementation leverages `ServiceUserMapper.getServiceUserID()` to resolve the right user id and throws a `LoginException` in case no mapping has been setup (and none of the fallbacks returned a user id != `null` either).
-
-### `SlingRepository`
-
-The third part is an extension to the `SlingRepository`service interface
-to support JCR Repository access for services:
-
-#!java
-Session loginService(String subServiceName, String workspace)
-throws LoginException, RepositoryException;
-
-This method allows for access to the JCR Repository for services where the
-service bundle is the bundle actually using the `SlingRepository`
-service. The additional Subservice Name may be provided with the
-`subServiceName` parameter.
-
-## Configuration
-
-### Service User Mappings
-
-For each service/subservice name combination an according mapping needs to be provided. The mapping binds a service name/subservice name to a JCR system user.
-This is configured through an OSGi configuration for the factory configuration with PID `org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended` [SLING-3578](https://issues.apache.org/jira/browse/SLING-3578). There you can set one configuration property named `user.mapping` getting a String array as value where each entry must stick to the following format:
-
-<service-name>[:<subservice-name>]=<authorizable id of a JCR system user>]
-
-The according user must exist at the point in time where `ResourceResolverFactory.getServiceResourceResolver(...)` or `SlingRepository.loginService(...)` is called. If you rely on one of those methods in your `activate` method of an OSGi component you should make sure that you defer starting your OSGi component until the according service user mapping is in place. For that you can reference the OSGi service `ServiceUserMapped` ([SLING-4312](https://issues.apache.org/jira/browse/SLING-4312)), optionally with a target filter on property `subServiceName` (in case such a subservice name is used). The service `ServiceUserMapped` does not expose any methods but is only a marker interface exclusively used to defer starting of other OSGi components. However this waits only for the mapping configuration to be available, it does not wait for the service user itself to be available.
-
-Example OSGi DS Component
-
-:::java
-@Component(
-reference = {
-// this waits with the activation of this component until a service user mapping with the service name = current bundle's id and the sub service name 'my-subservice-name' is available.
-// you can leave out "target" if the sub service name is not used.
-// Please note that this only waits for the mapping to be available, it does not wait for the service user itself to be available!
-@Reference(name ="scriptsServiceUser", target="(subServiceName=my-subservice-name)", service=ServiceUserMapped.class)
-}
-)
-class MyComponent {
-}
-
-There is a default mapping applied if no OSGi configuration is available for the mapping. The default is: "serviceuser--" + bundleId [ + "--" + subservice-name]. Please note, that these default mappings are not represented as a ServiceUserMapped service and therefore the above mentioned reference does not work.
-
-## Deprecation of administrative authentication
-
-Originally the `ResourceResolverFactory.getAdministrativeResourceResolver`
-and `SlingRepository.loginAdministrative` methods have been defined to
-provide access to the resource tree and JCR Repository. These methods
-proved to be inappropriate because they allow for much too broad access.
-
-Consequently these methods are being deprecated and will be removed in
-future releases of the service implementations.
-
-The following methods are deprecated:
-
-* `ResourceResolverFactory.getAdministrativeResourceResolver`
-* `ResourceProviderFactory.getAdministrativeResourceProvider`
-* `SlingRepository.loginAdministrative`
-
-The implementations we have in Sling's bundle will remain implemented
-in the near future. But there will be a configuration switch to disable
-support for these methods: If the method is disabled, a `LoginException`
-is always thrown from these methods. The JavaDoc of the methods is
-extended with this information.
-
-### Whitelisting bundles for administrative login
-
-In order to be able to manage few (hopefully legit) uses of the above deprecated
-methods, a whitelisting mechanism was introduced with [SLING-5153](https://issues.apache.org/jira/browse/SLING-5135) (*JCR Base 2.4.2*).
-
-The recommended way to whitelist a bundle for administrative login is via a
-_whitelist fragment configuration_. It can be created as an OSGi factory
-configuration with the factoryPID `org.apache.sling.jcr.base.internal.LoginAdminWhitelist.fragment`.
-E.g. a typical configuration file might be called
-`org.apache.sling.jcr.base.internal.LoginAdminWhitelist.fragment-myapp.config`
-and could look as follows:
-
-whitelist.name="myapp"
-whitelist.bundles=[
-"com.myapp.core",
-"com.myapp.commons"
-]
-
-| Property | Type | Default | Description |
-|---------------------|----------|-------------|-------------|
-| `whitelist.name` | String | `[unnamed]` | Purely informational property that allows easy identification of different fragments. |
-| `whitelist.bundles` | String[] | [] | An array of bundle symbolic names that should be allowed to make use of the administrative login functionality. |
-
-All configured whitelist fragments are taken into account. This makes
-it easy to separate whitelists for different application layers and
-purposes.
-
-For example, some Sling bundles need to be whitelisted, which
-could be done in a whitelist fragment named `sling`. In addition `myapp`
-adds a whitelist fragment called `myapp`. For integration tests and
-additional whitelist fragment `myapp-integration-testing` may be added.
-
-Furthermore, there is a global configuration with PID `org.apache.sling.jcr.base.internal.LoginAdminWhitelist`, which should
-only be used in exceptional cases. It has a switch to turn administrative
-login on globally (`whitelist.bypass`) and it allows supplying a regular
-expression to whitelist matching bundle symbolic names (`whitelist.bundles.regexp`).
-
-The regular expression is most useful for running PaxExam based tests, where
-bundle symbolic names follow a set pattern but have randomly generated parts.
-
-Example: to whitelist all bundles generated by PaxExam a configuration file named `org.apache.sling.jcr.base.internal.LoginAdminWhitelist.config` might look as follows:
-
-whitelist.bypass=B"false"
-whitelist.bundles.regexp="^PAXEXAM.*$"
-
-The configuration PID is `org.apache.sling.jcr.base.internal.LoginAdminWhitelist`.
-It supports the following configuration properties.
-
-| Property | Type | Default | Description |
-|----------------------------|----------|-------------|-------------|
-| `whitelist.bypass` | Boolean | false | Allow all bundles to use administrative login. This is __NOT__ recommended for production and warnings will be logged. |
-| `whitelist.bundles.regexp` | String | "" | A regular expression that whitelists all matching bundle symbolic names. This is __NOT__ recommended for production and warnings will be logged. |
http://git-wip-us.apache.org/repos/asf/sling-site/blob/7b703652/content/documentation/the-sling-engine/servlets.md
----------------------------------------------------------------------
diff --git a/content/documentation/the-sling-engine/servlets.md b/content/documentation/the-sling-engine/servlets.md
deleted file mode 100644
index 477e00e..0000000
--- a/content/documentation/the-sling-engine/servlets.md
+++ /dev/null
@@ -1,193 +0,0 @@
-title=Servlets and Scripts
-type=page
-status=published
-~~~~~~
-
-[TOC]
-
-See also [URL to Script Resolution](/documentation/the-sling-engine/url-to-script-resolution.html) which explains how Sling maps URLs
-to a script or and servlet.
-
-## Servlet Registration
-
-Servlets can be registered as OSGi services. The following service reference properties are evaluated for Servlets defined as OSGi services of type `javax.servlet.Servlet` (all those property names are defined in `org.apache.sling.api.servlets.ServletResolverConstants` (since API 2.15.2) or `org.apache.sling.servlets.resolver.internal.ServletResolverConstants` (before API 2.15.2)):
-
-| Name | Description |
-|--|--|
-| `sling.servlet.paths` | A list of absolute paths under which the servlet is accessible as a Resource. The property value must either be a single String, an array of Strings or a Vector of Strings.<br>A servlet using this property might be ignored unless its path is included in the *Execution Paths* (`servletresolver.paths`) configuration setting of the `SlingServletResolver` service. Either this property or the `sling.servlet.resourceTypes` property must be set, or the servlet is ignored. If both are set, the servlet is registered using both ways.<br>Binding resources by paths is discouraged, see [caveats when binding servlets by path](#caveats-when-binding-servlets-by-path) below. |
-| `sling.servlet.resourceTypes` | The resource type(s) supported by the servlet. The property value must either be a single String, an array of Strings or a Vector of Strings. Either this property or the `sling.servlet.paths` property must be set, or the servlet is ignored. If both are set, the servlet is registered using both ways. |
-| `sling.servlet.selectors` | The request URL selectors supported by the servlet. The selectors must be configured as they would be specified in the URL that is as a list of dot-separated strings such as <em>print.a4</em>. The property value must either be a single String, an array of Strings or a Vector of Strings. This property is only considered for the registration with `sling.servlet.resourceTypes`. |
-| `sling.servlet.extensions` | The request URL extensions supported by the servlet for requests. The property value must either be a single String, an array of Strings or a Vector of Strings. This property is only considered for the registration with `sling.servlet.resourceTypes`. |
-| `sling.servlet.methods` | The request methods supported by the servlet. The property value must either be a single String, an array of Strings or a Vector of Strings. This property is only considered for the registration with `sling.servlet.resourceTypes`. If this property is missing, the value defaults to GET and HEAD, regardless of which methods are actually implemented/handled by the servlet.|
-| `sling.servlet.prefix` | The prefix or numeric index to make relative paths absolute. If the value of this property is a number (int), it defines the index of the search path entries from the resource resolver to be used as the prefix. The defined search path is used as a prefix to mount this servlet. The number can be -1 which always points to the last search entry. If the specified value is higher than than the highest index of the search paths, the last entry is used. The index starts with 0. If the value of this property is a string and parseable as a number, the value is treated as if it would be a number. If the value of this property is a string starting with "/", this value is applied as a prefix, regardless of the configured search paths! If the value is anything else, it is ignored. If this property is not specified, it defaults to the default configuration of the sling servlet resolver. |
-
-A `SlingServletResolver` listens for `Servlet` services and - given the correct service registration properties - provides the servlets as resources in the (virtual) resource tree. Such servlets are provided as `ServletResource` instances which adapt to the `javax.servlet.Servlet` class.
-
-For a Servlet registered as an OSGi service to be used by the Sling Servlet Resolver, either one or both of the `sling.servlet.paths` or the `sling.servlet.resourceTypes` service reference properties must be set. If neither is set, the Servlet service is ignored.
-
-Each path to be used for registration - either from the `sling.servlet.paths` property or constructed from the other `sling.servlet.*` properties - must be absolute. Any relative path is made absolute by prefixing it with a root path. This prefix may be set with the `sling.servlet.prefix` service registration property. If this property is not set, the first entry in the `ResourceResolver` search path for the `ResourceResolver.getResource(String)` method is used as the prefix. If this entry cannot be derived, a simpe slash - `/` - is used as the prefix.
-
-If `sling.servlet.methods` is not specified, the servlet is only registered for handling GET and HEAD requests. Make sure to list all methods you want to be handled by this servlet.
-
-### Caveats when binding servlets by path
-
-Binding servlets by paths has several disadvantages when compared to binding by resource types, namely:
-
-* path-bound servlets cannot be access controlled using the default JCR repository ACLs
-* path-bound servlets can only be registered to a path and not a resource type (i.e. no suffix handling)
-* if a path-bound servlet is not active, e.g. if the bundle is missing or not started, a POST might result in unexpected results. usually creating a node at /bin/xyz which subsequently overlays the servlets path binding
-* the mapping is not transparent to a developer looking just at the repository
-
-Given these drawbacks it is strongly recommended to bind servlets to resource types rather than paths.
-
-### Registering a Servlet using Java Annotations
-
-If you are working with the default Apache Sling development stack you can either use
-
-* [OSGi DS annotations](https://osgi.org/javadoc/r6/cmpn/org/osgi/service/component/annotations/package-summary.html) (introduced with DS 1.2/OSGi 5, properly supported since [bnd 3.0](https://github.com/bndtools/bndtools/wiki/Changes-in-3.0.0), being used in [maven-bundle-plugin 3.0.0](http://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html)) or
-* Generic Felix SCR or Sling-specific `@SlingServlet` annotations from [Apache Felix Maven SCR Plugin](http://felix.apache.org/documentation/subprojects/apache-felix-maven-scr-plugin.html) to register your Sling servlets:
-
-The following examples show example code how you can register Servlets with Sling
-
-1. OSGi DS annotations (recommended)
-
-:::java
-@Component(
-service = { Servlet.class },
-property = {
-SLING_SERVLET_RESOURCE_TYPES + "=/apps/my/type"
-SLING_SERVLET_METHODS + "=GET",
-SLING_SERVLET_EXTENSIONS + "=html",
-SLING_SERVLET_SELECTORS + "=hello",
-}
-)
-public class MyServlet extends SlingSafeMethodsServlet {
-
-@Override
-protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException {
-...
-}
-}
-
-Custom OSGi DS annotations (e.g. for Sling servlets) are not yet supported by the OSGi spec (and therefore by bnd), but this is supposed to be fixed with DS 1.4 (OSGi 7), see also [FELIX-5396](https://issues.apache.org/jira/browse/FELIX-5396).
-
-2. The `@SlingServlet` annotation (evaluated by maven-scr-plugin)
-
-:::java
-@SlingServlet(
-resourceTypes = "/apps/my/type",
-selectors = "hello",
-extensions = "html",
-methods = "GET")
-public class MyServlet extends SlingSafeMethodsServlet {
-
-@Override
-protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException {
-...
-}
-}
-
-### Automated tests
-
-The [launchpad/test-services](http://svn.apache.org/repos/asf/sling/trunk/launchpad/test-services/) module contains test servlets that use various combinations of the above properties.
-
-The [launchpad/integration-tests](http://svn.apache.org/repos/asf/sling/trunk/launchpad/integration-tests/) module contains a number of tests (like the [ExtensionServletTest|http://svn.apache.org/repos/asf/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/resolution/ExtensionServletTest.java] for example) that verify the results.
-
-Such tests run as part of our continuous integration process, to demonstrate and verify the behavior of the various servlet registration mechanisms, in a way that's guaranteed to be in sync with the actual Sling core code. If you have an idea for additional tests, make sure to let us know!
-
-
-### Example: Registration by Path
-
-sling.servlet.paths = [ "/libs/sling/sample/html", "/libs/sling/sample/txt" ]
-sling.servlet.selectors = [ "img" ]
-sling.servlet.extensions = [ "html", "txt", "json" ]
-
-
-A Servlet service registered with these properties is registered under the following paths:
-
-* `/libs/sling/sample/html`
-* `/libs/sling/sample/txt`
-
-The registration properties `sling.servlet.selectors` and `sling.servlet.extensions` *are ignored* because the servlet is registered only by path (only `sling.servlet.paths` property is set).
-
-
-### Example: Registration by Resource Type etc.
-
-
-sling.servlet.resourceTypes = [ "sling/unused" ]
-sling.servlet.selectors = [ "img", "tab" ]
-sling.servlet.extensions = [ "html", "txt", "json" ]
-
-A Servlet service registered with these properties is registered for the following resource types:
-
-* `<prefix>/sling/unused/img/html`
-* `<prefix>/sling/unused/img/txt`
-* `<prefix>/sling/unused/img/json`
-* `<prefix>/sling/unused/tab/html`
-* `<prefix>/sling/unused/tab/txt`
-* `<prefix>/sling/unused/tab/json`
-
-As explained the Servlet is registered for each permutation of the resource types, selectors and extension. See above at the explanation of `sling.servlet.prefix` how `<prefix>` is defined.
-
-It is more common to register for absolute resource types or at least explicitly define `sling.servlet.prefix` as well, because otherwise you are in most cases not sure under which absolute path the Servlet is registered (and therefore by which
-other paths it might get overwritten).
-
-### Servlet Lifecycle Issues
-
-The Servlet API specification states the following with respect to the life
-cycle of Servlets:
-
-> The servlet container calls the init method exactly once after
-> instantiating the servlet.
-
-This works perfectly in a regular servlet container which both instantiates
-and initializes the servlets. With Sling the tasks of instantiation and
-initialization are split:
-
-* The provider of the Servlet service takes care of creating the servlet instance
-* The Sling Servlet Resolver picks up the Servlet services and initializes and destroys them as needed
-
-So Sling has not way of making sure a Servlet is only initialized and destroyed
-once in the life time of the Servlet object instance.
-
-The provider of the Servlet service on the other can cope with this
-situation by making sure to drop the servlet instance once it is destroyed.
-The mechanism helping the provider here is the OSGi Service Factory.
-
-
-
-## Scripts are Servlets
-
-
-The Sling API defines a `SlingScript` interface which is used to represent (executable) scripts inside of Sling. This interface is implemented in the `scripting/core` bundle in the `DefaultSlingScript` class which also implements the `javax.servlet.Servlet`.
-
-To further simplify the access to scripts from the Resource tree, the `scripting/core` bundle registers an `AdapterFactory` to adapt Resources to Scripts and Servlets (the `SlingScriptAdapterFactory`). In fact the adapter factory returns instances of the `DefaultSlingScript` class for both Scripts and Servlets.
-
-From the perspective of the Servlet resolver, scripts and servlets are handled exactly the same. In fact, internally, Sling only handles with Servlets, whereas scripts are packed inside a Servlet wrapping and representing the script.
-
-
-
-## Default Servlet(s)
-
-As explained in the Resolution Process section above, a default Servlet is selected if no servlet (or script) for the current resource type can be found. To make the provisioning of a default Servlet as versatile as provisioning per resource type Servlets (or scripts), the default Servlet is selected with just a special resource type `sling/servlet/default`.
-
-The actual Servlet or Script called as the default Servlet is resolved exactly the same way as for any resource type. That is, also for the default Servlet selection, the request selectors and extension or method are considered. Also, the Servlet may be a Servlet registered as an OSGi service or it may be a Script stored in the repository or provided by any bundle.
-
-Finally, if not even a registered default Servlet may be resolved for the request, because none has been registered, the `servlets/resolver` bundle provides a fall back the `DefaultServlet` with the following functionality:
-
-* If an `NonExistingResource` was created for the request the `DefaultServlet` sends a 404 (Not Found)
-* Otherwise the `DefaultServlet` sends a 500 (Internal Server Error), because normally at least a `NonExistingResource` should be created
-
-
-## OptingServlet interface
-
-If a registered servlet implements the OptingServlet interface, Sling uses that servlet's `accepts(SlingHttpServletRequest request)` method to refine the servlet resolution process.
-
-In this case, the servlet is only selected for processing the current request if its `accept` method returns true.
-
-While an opting servlet seems to be a nice way of picking the right servlet to process the request, the use of an opting servlet is not recommended: the main reason is that it complicates the request processing, makes it less transparent what is going on during a request and prevents optimizations like caching the script resolution in an optimal manner. The other static options are usually sufficient for all use cases.
-
-
-## Error Handler Servlet(s) or Scripts
-
-Error handling support is described on the [Errorhandling](/documentation/the-sling-engine/errorhandling.html) page.
http://git-wip-us.apache.org/repos/asf/sling-site/blob/7b703652/content/documentation/the-sling-engine/sling-api-crud-support.md
----------------------------------------------------------------------
diff --git a/content/documentation/the-sling-engine/sling-api-crud-support.md b/content/documentation/the-sling-engine/sling-api-crud-support.md
deleted file mode 100644
index 23fe6a8..0000000
--- a/content/documentation/the-sling-engine/sling-api-crud-support.md
+++ /dev/null
@@ -1,172 +0,0 @@
-title=Sling API CRUD Support
-type=page
-status=published
-~~~~~~
-
-[TOC]
-
-## Apache Sling API Support
-
-As of version 2.3.0, the Sling API provides full Create Read Update Delete (CRUD) features. CRUD support is provided by the addition of the following methods to the ResourceResolver:
-
-* [void delete(Resource resource) throws PersistenceException](https://sling.apache.org/apidocs/sling7/org/apache/sling/api/resource/ResourceResolver.html#delete-org.apache.sling.api.resource.Resource-)
-* [Resource create(Resource parent, String name, Map<String, Object> properties) throws PersistenceException](https://sling.apache.org/apidocs/sling7/org/apache/sling/api/resource/ResourceResolver.html#create-org.apache.sling.api.resource.Resource-java.lang.String-java.util.Map-)
-* [void revert()](https://sling.apache.org/apidocs/sling7/org/apache/sling/api/resource/ResourceResolver.html#revert--)
-* [void commit() throws PersistenceException](https://sling.apache.org/apidocs/sling7/org/apache/sling/api/resource/ResourceResolver.html#commit--)
-* [boolean hasChanges()](https://sling.apache.org/apidocs/sling7/org/apache/sling/api/resource/ResourceResolver.html#hasChanges--)
-* [void refresh()](https://sling.apache.org/apidocs/sling7/org/apache/sling/api/resource/ResourceResolver.html#refresh--)
-
-Which provide the ability to create and delete resources as well as the addition of the ModifiableValueMap interface which is similar to the ValueMap interface, but allows for updating properties on a resource.
-
-## Comparing Sling API CRUD to Sling Post Servlet
-
-Here are some examples of common operations performed using the Sling Post Servlet and Sling API CRUD support. Note, the examples are derived from the [SlingPostServlet Cheatsheet](http://dev.day.com/content/ddc/blog/2008/07/cheatsheet/_jcr_content/images/cheatsheet/back.png).
-
-### Updating a Property
-
-Update /myresource, setting the title and body:
-
-**Sling Post Servlet**
-
-<form action="/myresource" method="POST">
-<input type="text" name="title">
-<textarea name="body">
-</form>
-
-**Sling API CRUD**
-
-Resource myResource = resourceResolver.getResource("/myresource");
-ModifiableValueMap properties = myNode.adaptTo(ModifiableValueMap.class);
-properties.put("title", {TITLE});
-properties.put("body", {BODY});
-resourceResolver.commit();
-
-### Create New Resource
-
-Create a new resource below /myresource
-
-**Sling Post Servlet**
-
-<form action="/myresource/" method="POST">
-<input type="text" name="dummy">
-</form>
-
-**Sling API CRUD**
-
-Resource myResource = resourceResolver.getResource("/myresource");
-Map<String,Object> properties = new HashMap<String,Object>();
-properties.put("jcr:primaryType", "nt:unstructured");
-properties.put("sling:resourceType", "myapp/components/mytype");
-Resource dummy = resourceResolver.create(myResource, "dummy", properties);
-resourceResolver.commit();
-
-### Remove a Property
-
-Remove the property title
-
-**Sling Post Servlet**
-
-<form action="/myresource" method="POST">
-<input type="hidden" name="title@Delete">
-</form>
-
-**Sling API CRUD**
-
-Resource myResource = resourceResolver.getResource("/myresource");
-ModifiableValueMap properties = myResource.adaptTo(ModifiableValueMap.class);
-properties.remove("title");
-resourceResolver.commit();
-
-### Copy a Resource
-
-Copy the resource /myresource to /myresource2
-
-**Sling Post Servlet**
-
-<form action="/myresource" method="POST">
-<input type="hidden" name=":operation" value="copy">
-<input type="hidden" name=":dest" value="/myresource2">
-<input type="hidden" name=":replace" value="true">
-</form>
-
-**Sling API CRUD**
-
-Map<String,Object> properties = myResource.adaptTo(ValueMap.class);
-Resource myResource2 = resourceResolver.create(null, "myresource2", properties);
-resourceResolver.commit();
-
-### Move a Resource
-
-Move the resource /myresource2 to /myresource3
-
-**Sling Post Servlet**
-
-<form action="/myresource2" method="POST">
-<input type="hidden" name=":operation" value="move">
-<input type="hidden" name=":dest" value="/myresource3">
-</form>
-
-**Sling API CRUD**
-
-Resource myResource2 = resourceResolver.getResource("/myresource2");
-Map<String,Object> properties = myResource2.adaptTo(ValueMap.class);
-Resource myResource3 = resourceResolver.create(null, "myresource3", properties);
-resourceResolver.delete(myResource2);
-resourceResolver.commit();
-
-### Setting non-String Value
-
-Set the property date to a particular date
-
-**Sling Post Servlet**
-
-<form action="/myresource3" method="POST">
-<input type="text" name="date" value="2008-06-13T18:55:00">
-<input type="hidden" name="date@TypeHint" value="Date">
-</form>
-
-**Sling API CRUD**
-
-Resource myResource3 = resourceResolver.getResource("/myresource3");
-Calendar calendar = [SOME_DATE];
-ModifiableValueMap properties = myResource3.adaptTo(ModifiableValueMap.class);
-properties.put("date", calendar);
-resourceResolver.commit();
-
-### Delete a Resource
-
-Delete the resource /myresource
-
-**Sling Post Servlet**
-
-<form action="/myresource" method="POST">
-<input type="hidden" name=":operation" value="delete">
-</form>
-
-**Sling API CRUD**
-
-Resource myResource = resourceResolver.getResource("/myresource");
-resourceResolver.delete(myResource);
-resourceResolver.commit();
-
-## Value Class Support
-
-
-<div class="info">
-Please note, this information is specific to the Sling JCR Resource implementation provided by the Apache Sling project. Other implementations may have different value class support.
-</div>
-
-The Classes implementing the following types are supported directly when setting properties:
-
-* [Calendar](http://docs.oracle.com/javase/8/docs/api/java/util/Calendar.html)
-* [InputStream](http://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html)
-* [Node](http://www.day.com/maven/javax.jcr/javadocs/jcr-2.0/javax/jcr/Node.html)
-* [BigDecimal](http://docs.oracle.com/javase/8/docs/api/java/math/BigDecimal.html)
-* [Long](http://docs.oracle.com/javase/8/docs/api/java/lang/Long.html)
-* [Short](http://docs.oracle.com/javase/8/docs/api/java/lang/Short.html)
-* [Integer](http://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html)
-* [Number](http://docs.oracle.com/javase/8/docs/api/java/lang/Number.html)
-* [Boolean](http://docs.oracle.com/javase/8/docs/api/java/lang/Boolean.html)
-* [String](http://docs.oracle.com/javase/8/docs/api/java/lang/String.html)
-
-As well as the corresponding primitive types. Any object which implements the Serializable interface will be serialized and the result of the serialization will be saved as a binary value for the property.
http://git-wip-us.apache.org/repos/asf/sling-site/blob/7b703652/content/documentation/the-sling-engine/sling-properties.md
----------------------------------------------------------------------
diff --git a/content/documentation/the-sling-engine/sling-properties.md b/content/documentation/the-sling-engine/sling-properties.md
deleted file mode 100644
index 8e5d417..0000000
--- a/content/documentation/the-sling-engine/sling-properties.md
+++ /dev/null
@@ -1,51 +0,0 @@
-title=Well-known Sling Properties
-type=page
-status=published
-~~~~~~
-
-This table lists properties which have known functionality in the OSGi and Sling frameworks.
-
-With the exception of the Sling setup properties (`sling.home`, `sling.launchpad`, and `sling.properties`) all properties can be set on the command line using the `-D` command line option or in the `sling.properties` file. Properties defined on the command line or in the `web.xml` file always overwrite properties in the `sling.properties` file.
-
-[TOC]
-
-
-## Sling Setup Properties
-
-| Property | Default Value | Description |
-|---|---|---|
-| `sling.home` | `sling` | Path to the main Sling Directory; relative path is resolved against current working directory as defined in the `user.dir` system property. Can also be set with the `-c` command line option. | Launchpad |
-| `sling.launchpad` | `${sling.home}` | Location for the Sling launchpad JAR file and the startup folder containing bundles to be installed by the Bootstrap Installer. Can also be set with the `-i` command line option. | Launchpad |
-| `sling.properties` | `${sling.home}/sling.properties` | Path to the `sling.properties` file; relative path is resolved against `${sling.home}` | Launchpad |
-
-## Server Control Port Properties
-
-| Property | Default Value | Description |
-|---|---|---|
-| `sling.control.socket` | `127.0.0.1:0` | Specification of the control port. Can also be set with the `-j` command line option. This property is only used by the Standalone Sling Application. | Launchpad |
-| `sling.control.action` | -- | Action to execute. This is the same as specifying `start`, `status`, or `stop` on the command line. This property is only used by the Standalone Sling Application. | Launchpad |
-
-## Logging Configuration
-
-Logging configuration defined by these properties sets up initial configuration for the Sling Commons Log bundle. This configuration is used as long as there is no configuration from the Configuration Admin Service for the service PID `org.apache.sling.commons.log.LogManager`.
-
-| Property | Default Value | Description |
-|---|---|---|
-| `org.apache.sling.commons.log.level` | `INFO` | Sets the initial logging level of the root logger. This may be any of the defined logging levels `DEBUG`, `INFO`, `WARN`, or `ERROR`. This property can also be set with the `-l` command line option. |
-| `org.apache.sling.commons.log.file` | `${sling.home}/logs/error.log` | Sets the log file to which log messages are written. If this property is empty or missing, log messages are written to System.out. This property can also be set with the `-f` command line option. |
-| `org.apache.sling.commons.log.file.number` | `5` | The number of rotated files to keep. |
-| `org.apache.sling.commons.log.file.size` | `'.'yyyy-MM-dd` | Defines how the log file is rotated (by schedule or by size) and when to rotate. See the section [Log File Rotation](http://sling.apache.org/site/logging.html#Logging-LogFileRotation) for full details on log file rotation. |
-| `org.apache.sling.commons.log.pattern` | `{0,date,dd.MM.yyyy HH:mm:ss.SSS} *{4}* [{2}] {3} {5}` | The MessageFormat pattern to use for formatting log messages with the root logger. |
-| org.apache.sling.commons.log.julenabled | `false` | Enables the java.util.logging support. |
-
-See [Logging](http://sling.apache.org/site/logging.html) for full information on configuring the Sling Logging system.
-
-
-## Http Service Properties
-
-| Property | Default Value | Description |
-|---|---|---|
-| `org.apache.felix.http.context_path` | `/` | The servlet context path for the Http Service of the embedded servlet container. This property requires support by the Http Service bundle. |
-| `org.apache.felix.http.host` | `0.0.0.0` | The host interface to bind the HTTP Server to. This property requires support by the Http Service bundle. |
-| `org.osgi.service.http.port` | 8080 | The port to listen on for HTTP requests. This property requires support by the Http Service bundle. |
-
http://git-wip-us.apache.org/repos/asf/sling-site/blob/7b703652/content/documentation/the-sling-engine/the-sling-launchpad.md
----------------------------------------------------------------------
diff --git a/content/documentation/the-sling-engine/the-sling-launchpad.md b/content/documentation/the-sling-engine/the-sling-launchpad.md
deleted file mode 100644
index 8f4ad76..0000000
--- a/content/documentation/the-sling-engine/the-sling-launchpad.md
+++ /dev/null
@@ -1,190 +0,0 @@
-title=The Sling Launchpad
-type=page
-status=published
-~~~~~~
-
-[TOC]
-
-This tries to explain how exactly the Sling Launchpad works, what constitutes the Sling Launchpad and how you can use the Sling Launchpad to custom create you Sling launchers. For a view behind the scenes of the Sling Launchpad Base module (the actual launcher) you might want to refer to the [Embedding Sling](/documentation/development/embedding-sling.html) page.
-
-
-## Sling Home
-
-Since Sling requires some space on the filesystem to store various files Sling has to know where this filesystem space is located.
-
-The following is a list of uses for the Sling Home directory:
-
-* `sling.properties` -- The main configuration file used by Sling to launch the framework. It mainly contains OSGi framework configuration and initial configuration for some bundles. This file is read on each startup of *Launcher JAR*. That is, changes to this file require a restart of the *Launcher JAR*.
-* `org.apache.sling.launchpad.base.jar` -- This is the *Launcher JAR* file used by the Standalone Application or the Web Application to start the OSGi Framework. This file is initially placed when first starting Sling and may later be updated by updating the system bundle with a new *Launcher JAR*.
-* `felix` -- The directory into which the Apache Felix Framework places the bundles, which have been installed into the system. This does generally not need to be touched.
-* `config` -- The directory into which the Apache Felix Configuration Admin Service stores the configurationes. Do not change any files in this directory, since changes will not generally be picked up.
-* `jackrabbit` -- The directory in which the Apache Jackrabbit JCR repository is started ( only applicable when using Apache Jackrabbit 2.x ). This is only available for Sling Launchpad 7 or older. Amongst other things this also contains the Jackrabbit configuration file `repository.xml`. You may modify this file, but don't forget to restart the Embedded Jackrabbit Repository bundle after doing this.
-* `oak` - The directory in which the Apache Jackrabbit Oak JCR Repository is started ( only applicable when using Apache Jackrabbit Oak with the SegmentNodeStoreBackend ). This is only available for Sling Launchpad 8 or newer.
-* `logs` -- Contains the log files generated by Sling. By default this contains the error.log and its rotated generations.
-
-
-## Command Line Options
-
-
-The Java Standalone Application supports a number of command line options, which influence the operation of the launch process.
-
-| Option | Argument | Description |
-|--|--|--|
-| `start` | -- | Open a TCP/IP server socket when starting Sling. Uses option `-j` to define the local socket address. |
-| `status` | -- | Check whether a (remote) Sling application is running. Uses option `-j` to define the address of the Sling instance to check. Note, that the Sling application terminates after checking for the (remote) Sling status. |
-| `stop` | -- | Stop a (remote) Sling application is running. Uses option `-j` to define the address of the Sling instance to stop. Note, that the Sling application tesrminates after stopping the (remote) Sling instance. |
-| `-j` | [ host ":" ] port | The socket address to listen on for control connections (`start` or to use as the remote endpoint for the control connection (`status` and `stop`. If this parameter has no arguments or is not specified, the address defaults to any free port on localhost/127.0.0.1. If only the port is specified localhost/127.0.0.1 is used as the host part of the address. |
-| `-c` | slinghome | The directory in which Sling locates its initial configuration file `sling.properties` and where files of Sling itself such as the Apache Felix bundle archive or the JCR repository files are stored. This defaults to the `sling` folder in the current working directory. This is the value which is commonly refered to as `${sling.home}.`
-| `-i` | launchpadhome | The launchpad directory. If not set, this is the same as `${sling.home}.` (since Sling Launchpad 2.4.0) |
-| `-l` | loglevel | Sets the initial loglevel as an integer in the range 0 to 4 or as one of the well known level strings `ERROR`, `WARN`, `INFO`, or `DEBUG`. This option overwrites the `org.apache.sling.osg.log.level` setting the `sling.properties` file. The default is `INFO`. |
-| `-f` | logfile | The log file to use or `-` to log to standard out. This option overwrites the `org.apache.sling.osg.log.file` setting in the `sling.properties` file. The default is `${sling.home}/logs/error.log`. |
-| `-a` | address | The interfact to bind to (use 0.0.0.0 for any). This option overwrites the `org.apache.felix.http.host` setting in the `sling.properties` file and requires the embedded Http Service implementation to honor this property. (supported since Sling Launchpad 2.4.0) |
-| `-p` | port | The port to listen (default 8080) to handle HTTP requests. This option overwrites the `org.osgi.service.http.port` setting in the `sling.properties` file. |
-| `-r` | path | The root servlet context path for the Http Service (default is /). This option overwrites the `org.apache.felix.http.context_path` setting in the `sling.properties` file and requires the embedded Http Service implementation to honor this property. (since Sling Launchpad 2.4.0) |
-| `-D` | n=v | Sets the property `n` to the value `v`. This option can be added repeatedly setting additional properties. Any property set in this manner overwrites same named properties in the `sling.properties` file. (since Sling Launchpad 2.4.0) |
-| `-n` | -- | Don't install the shutdown hook. See [Shutdown Hook](#shutdown-hook) below. (since Sling Launchpad 2.5.2) |
-| `-h` | -- | Prints a simple usage message listing all available command line options. |
-
-The Sling Standalone application looks for a definition of the `sling.home` setting in the following locations in order of precendence:
-
-1. The `-c` command line option
-1. The `sling.home` system property
-1. The `SLING_HOME` environment variable
-1. If none of the above resolves to a non-null value, the default value of `sling` is assumed
-
-
-### Control Port
-
-When starting the Sling Standalone Application with the `start` command line option, a TCP control port is opened to receive simple commands which allow for stopping an instance and getting thread dumps.
-
-Currently supported commands are
-
-* `stop` to stop the Sling instance
-* `status` to get the instance status (OK or STOPPING)
-* `threads` to get a thread dump
-
-For the Whole Truth about this functionality see the [ControlListener class source code](https://svn.apache.org/repos/asf/sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/app/ControlListener.java).
-
-The interface and port is configurable with the `-j` command line option. The actual address and port used are written to the `${sling.home}/conf/controlport` file. So technically the `-j` option is not required for the `status` and `stop` operations because the port information can be read from that file.
-
-Note that using a control connection for the Sling Standalone Application presents a potential security issue. For this reason the following defaults apply:
-
-* The server side socket for a running Sling Standalone Application is not created by default, but only if the application is started with the `start` command line option.
-* The default control port configuration is `localhost/127.0.0.1` meaning that the socket is only accessible from the same system as the Sling Standalone Application is running on.
-* A nonce, followed by a space character, must be used as a prefix for every command sent to the control port. This nonce is generated by Sling at startup and also written to the `controlport` file mentioned above.
-
-For additional security, do not allow the control port to be opened on an externally visible network interface and strictly restrict access to the Sling installation folder (`${sling.home}`).
-
-Here's an example session where a Sling Standalone Application is started with the control port active:
-
-$ java -jar target/org.apache.sling.launchpad-9-SNAPSHOT.jar start
-05.04.2016 11:50:45.003 *INFO * [main] Setting sling.home=sling (default)
-05.04.2016 11:50:45.006 *INFO * [main] Starting Apache Sling in /foo/sling/launchpad/builder/sling
-...
-05.04.2016 11:50:45.012 *INFO * [Apache Sling Control Listener@/127.0.0.1:59239] Apache Sling Control Listener started
-...
-
-And stopped using its control port, from another terminal:
-
-$ cat sling/conf/controlport
-127.0.0.1:59239
-mdsryh1k5fpcgvm7suqnckxkr7fvluzv
-
-$ telnet 127.0.0.1 59239
-Trying 127.0.0.1...
-Connected to localhost.
-Escape character is '^]'.
-
-mdsryh1k5fpcgvm7suqnckxkr7fvluzv stop
-
-OK
-Connection closed by foreign host.
-
-
-### Shutdown Hook
-
-By default the Sling Launchpad standalone application installs a Shutdown Hook with the Java Runtime to make sure the framework is properly
-terminated in case of a Java termination. In some situations or setups you want to control shutdown of Sling yourselves, so Sling supports a command
-line option `-n` to prevent the installation of a shutdown hook.
-
-Apart from the command line option, the `sling.shutdown.hook` system property is also supported: If this property is set to `true` or is not set at all
-the shutdown hook is installed as expected. If the property is set to anything other than `true`, e.g. `false`, the shutdown hook is not installed.
-
-If you are embedding the Sling Launchpad application's `Main` class, the `sling.shutdown.hook` property can also be set as a member of the `props` map
-handed to the `Main` constructor.
-
-
-## Servlet Parameters
-
-The Web Application does not require specific servlet parameters. Those which are specified are used to overwrite any properties with the same name from the `sling.properties` file. One exception to this rule is the `sling.home` parameter, which is used to set the value of the `sling.home` property. If no parameter with this name is defined the Sling home directory is derived from the context path at which the Sling Web Application is registered.
-
-The `sling.home` folders for Sling Web Applications without the `sling.home` servlet parameter are all located in the `sling` folder in the current working directory as reported by the `user.dir` system property. The name of the actual directory is derived from the Web Application Context Path by replacing all slash characters `/` by underscore characters `_`. For the root context a single underscore character `_` is used.
-
-Examples:
-
-| Servlet Context | Default `sling.home` |
-|--|--|
-| *root* | `sling/_` |
-| `/sling` | `sling/_sling` |
-| `/sling/instance1` | `sling/_sling/instance1` |
-
-Starting with Launchpad Base 2.2.2 the fixed prefix `sling` is configurable with the `sling.home.prefix` system property. If this property is set the value used as the prefix.
-
-Examples: Assume the `sling.home.prefix` system property is set to `/var/sling`
-
-| Servlet Context | Default `sling.home` |
-|--|--|
-| *root* | `/var/sling/_` |
-| `/sling` | `/var/sling/_sling` |
-| `/sling/instance1` | `/var/sling/_sling/instance1` |
-
-
-## sling.properties
-
-The `sling.properties` file contains the initial setup of the Sling Application and the OSGi framework. Some of the parameters are required and should not be modified without a very good reason. Some parameters may be freely modified to your needs. Please see the inlined comment in the `sling.properties` file installed when Sling is first started.
-
-One thing to note is, that the `sling.properties` file is a simple Java Properties file with support for property references. That is, the value of properties may refer other property values by means of the well known `${name}` notation. Such property references may even be nested as in
-
-
-java.packages=${jre-${java.specification.version}}
-
-
-
-## Components
-
-The Sling Launchapd consists of *Launchbad Base* project and three additional projects which ultimately create a Standalone Java Application and a Web Appliction with standard parts of Sling.
-
-
-### Launchpad Base
-
-The *Launchpad Base* projects creates the following artifacts, which are required in actual setups to get a Sling application:
-
-* *Launcher JAR* -- The primary artifact of the Base project contains the actual support to launch the Apache Felix OSGi Framework and install bundles, which are packaged with the application. It also contains the Apache Felix Framework together with the OSGi R4.1 Core and Compendium libraries as well as the Equinox HttpService bridge and the Servlet API.
-
-* *App JAR* -- The secondary artifact with classifier *app* is a minimal Standalone Java Application which may be started by simply typing
-
-
-$ java -jar org.apache.sling.launchpad.base-app.jar
-
-
-* *Web App Archive* -- The secondary artifact with classifier *webapp* is a minimal Web Application, which may simply be deployed into your favirourite servlet container, provided it supports at least Servlet API 2.4.
-
-* *Source JAR* -- The secondary artifact with the classifier *sources* is simple the source of the *Launchpad Base* project.
-
-To build a very basic Sling launcher, the *Launchpad Base* is actually all you need. But to really glue this together and get a usable system, some more work is required. Lets see how the additionaly projects *Launchpad Bundles*, *Launchpad App*, and *Launchpad WebApp* get to that.
-
-### Launchpad App and Launchpad WebApp
-
-The *Launchpad App* and *Launchpad WebApp* bundles are actually projects which just glue together artifacts from the Launchpad projects. There is nothing special about them. Here's what is done:
-
-* Take the appropriate secondary artifact from the *Launchpad Base* project: *app* for the Standalone Java Application or *webapp* for the Web Application and unpack
-* Take the *Launchpad Base* primary artifact and place it under the name `org.apache.sling.launchpad.base.jar` into the `resources` folder
-* Copies the list of artifacts defined in the [Provisioning model](/documentation/development/slingstart.html)
-* Finally pack all together into a single big JAR or WAR file
-
-The artifacts can be configured to use different JCR repository implementations, based on the value of the `-Dsling.run.modes` property. The following run modes are available for the 8 version of the Sling Launchpad:
-
-* `oak`: configures and starts up an Apache Jackrabbit Oak repository implementation with a SegmentNodeStore ( TarMK ) implementation
-* `oak,oak_mongo`: configures and starts up an Apache Jackrabbit Oak repository implementation with a DocumentNodeStore implementation connected to a MongoDB database. The default configuration points to a MongoDB instance at mongodb://localhost:27017 and a database named sling.
-
-That's it. The resulting artifact may be directly used to launch the Standalone Java Application or may directly be deployed into any Servlet API 3.0 (or later) compliant servlet container.
http://git-wip-us.apache.org/repos/asf/sling-site/blob/7b703652/content/documentation/the-sling-engine/url-decomposition.md
----------------------------------------------------------------------
diff --git a/content/documentation/the-sling-engine/url-decomposition.md b/content/documentation/the-sling-engine/url-decomposition.md
deleted file mode 100644
index d29eba0..0000000
--- a/content/documentation/the-sling-engine/url-decomposition.md
+++ /dev/null
@@ -1,49 +0,0 @@
-title=URL decomposition
-type=page
-status=published
-~~~~~~
-
-[TOC]
-
-# Overview #
-During the *Resource Resolution* step, the client request URI (as being returned by [HttpServletRequest.getRequestURI()](http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html#getRequestURI())) is decomposed into the following parts (in exactly this order):
-
-1. **Resource Path** - For existing resources the resource path is the longest match (also considering its [mappings](/documentation/the-sling-engine/mappings-for-resource-resolution.html)) pointing to a resource where the next character is either a dot (`.`) or it is the full request URI.
-Otherwise (for a path not matching any existing resource) the resource path ends at the *first dot (`.`)* in the request url. The exact logic for retrieving the resource path is implemented at [ResourceResolver.resolve(HttpServletRequest,String)](https://sling.apache.org/apidocs/sling7/org/apache/sling/api/resource/ResourceResolver.html#resolve-javax.servlet.http.HttpServletRequest-java.lang.String-). *It is impossible to tell from just looking at the request URI where the resource path part ends. You have to know the underlying resource structure to know how a URL is decomposed. You cannot safely assume that the resource path will always end at the first dot!*.
-1. **Selectors** - If the first character in the request URL after the resource path is a dot (`.`), the string after the dot up to but not including the last dot before the next slash character or the end of the request URL comprises the selectors. If the resource path spans the complete request URL no selectors exist. If only one dot follows the resource path before the end of the request URL or the next slash, also no selectors exist.
-1. **Extension** - The string after the last dot after the resource path in the request URL but before the end of the request URL or the next slash after the resource path in the request URL is the extension.
-1. **Suffix** - If the request URL contains a slash character after the resource path and optional selectors and extension, the path starting with the slash up to the end of the request URL is the suffix path. Otherwise, the suffix path is empty. Note, that after the resource path at least a dot must be in the URL to let Sling detect the suffix.
-
-Those decomposed parts can be accessed through the `RequestPathInfo` object, which is retrieved via [SlingHttpServletRequest.getPathInfo()](https://sling.apache.org/apidocs/sling7/org/apache/sling/api/SlingHttpServletRequest.html#getRequestPathInfo--).
-
-There's a cheat sheet in Adobe's AEM documentation at [https://docs.adobe.com/docs/en/aem/6-2/develop/platform/sling-cheatsheet.html](https://docs.adobe.com/docs/en/aem/6-2/develop/platform/sling-cheatsheet.html) available to get you familiar with the URL decomposition of Sling.
-
-# Examples #
-Assume there is a Resource at `/a/b`, which has no children.
-
-| URI | Resource Path | Selectors | Extension | Suffix | Resource Found |
-|--|--|--|--|--|--|
-| /a/b | /a/b | null | null | null | yes |
-| /a/b.html | /a/b | null | html | null | yes |
-| /a/b.s1.html | /a/b | s1 | html | null | yes |
-| /a/b.s1.s2.html | /a/b | s1.s2 | html | null | yes |
-| /a/b/c/d | /a/b/c/d | null | null | null | no! |
-| /a/c.html/s.txt | /a/c | null | html | /s.txt | no! |
-| /a/b./c/d | /a/b | null | null | /c/d | yes |
-| /a/b.html/c/d | /a/b | null | html | /c/d | yes |
-| /a/b.s1.html/c/d | /a/b | s1 | html | /c/d | yes |
-| /a/b.s1.s2.html/c/d | /a/b | s1.s2 | html | /c/d | yes |
-| /a/b/c/d.s.txt | /a/b/c/d | s | txt | null | no! |
-| /a/b.html/c/d.s.txt | /a/b | null | html | /c/d.s.txt | yes |
-| /a/b.s1.html/c/d.s.txt | /a/b | s1 | html | /c/d.s.txt | yes |
-| /a/b.s1.s2.html/c/d.s.txt | /a/b | s1.s2 | html | /c/d.s.txt | yes |
-
-
-# Automated Tests #
-
-The tests at
-
-* [ResourceResolverImplTest](http://svn.apache.org/repos/asf/sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/ResourceResolverImplTest.java) shows the split between resource path and the rest. Mostly in the method `testBasicAPIAssumptions`.
-* [SlingRequestPathInfoTest](http://svn.apache.org/repos/asf/sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/impl/request/SlingRequestPathInfoTest.java) demonstrates the decomposition after the resource path part.
-
-Feel free to suggest additional tests that help clarify how this works!
http://git-wip-us.apache.org/repos/asf/sling-site/blob/7b703652/content/documentation/the-sling-engine/url-to-script-resolution.md
----------------------------------------------------------------------
diff --git a/content/documentation/the-sling-engine/url-to-script-resolution.md b/content/documentation/the-sling-engine/url-to-script-resolution.md
deleted file mode 100644
index e85d38e..0000000
--- a/content/documentation/the-sling-engine/url-to-script-resolution.md
+++ /dev/null
@@ -1,108 +0,0 @@
-title=URL to Script Resolution
-type=page
-status=published
-~~~~~~
-
-[TOC]
-
-This page explains how Sling maps URLs to a script or and servlet.
-
-See also [Servlets and Scripts](/documentation/the-sling-engine/servlets.html) which provides detailed info about how to register servlets.
-
-First of all Sling looks up the resource identified by the URL - typically a path inside the JCR repository, which is annotated by the `sling:resourceType` property
-which defines the resource type of that resource. Using this resource type (which is kind of a relative path,
-eg. "myblog/comment"), scripts or servlets are looked up. For more details about how the initial resource is identified for a specific request URL look at [URL decomposition](/documentation/the-sling-engine/url-decomposition.html).
-
-Scripts and servlets are itself resources in Sling and thus have a resource path: this is either the location in the
-JCR repository, the resource type in a servlet component configuration or the "virtual" bundle resource path
-(if a script is provided inside a bundle without being installed into the JCR repository).
-
-For the whole Truth about script resolution, see the [ScriptSelectionTest](http://svn.apache.org/repos/asf/sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ScriptSelectionTest.java) class. If you see interesting cases that are not
-covered there, please let us know via the Sling users mailing list.
-
-TODO: explain super types, servlet path mappings, node type resource types (`my:type -> my/type`)
-
-## Fundamental: Scripts and Servlets are equal
-
-In the following discussion, I will write about scripts. This will always include servlets as well. In fact, internally, Sling only handles with Servlets, whereas scripts are packed inside a Servlet wrapping and representing the script.
-
-## Base: Resource Type Inheritance
-
-While not exactly part of our discussion, resource type inheritance as implemented for [SLING-278](https://issues.apache.org/jira/browse/SLING-278) plays a vital role in script resolution.
-
-Each resource type may have a resource super type, which may be defined in various ways. One example is having a `sling:resourceSuperType` property in the node addressed by the resource type. See [http://www.mail-archive.com/sling-dev@incubator.apache.org/msg02365.html](http://www.mail-archive.com/sling-dev@incubator.apache.org/msg02365.html) and [SLING-278](http://issues.apache.org/jira/browse/SLING-278) for more details.
-
-If a resource type has no explicit resource super type, the resource super type is assumed to be "sling/servlet/default". That is the resource type used for default script selection is also acting as a basic resource type much like java.lang.Object does for other types in the Java language.
-
-## Script Locations
-
-Scripts are looked up in a series of locations defined by the ResourceResolver.getSearchPath() and the resource type (and resource super types) of the requested resource:
-
-{scriptPathPrefix}/{resourceTypePath}
-
-The pseudo code for iterating the locations would be something like:
-
-
-var type = resource.getResourceType();
-while (type != null) {
-for (String root: resourceResolver.getSearchPath()) {
-String path = root + type.toPath();
-findScriptsIn(path);
-}
-
-if (type == defaultServlet) {
-type = null;
-} else {
-type = getResourceSuperType(type);
-if (type == null) {
-type = defaultServlet;
-}
-}
-}
-
-
-## All requests are NOT equal
-
-GET and HEAD request methods are treated differently than the other request methods. Only for GET and HEAD requests will the request selectors and extension be considered for script selection. For other requests the servlet or script name (without the script extension) must exactly match the request method.
-
-That is for a PUT request, the script must be PUT.esp or PUT.jsp. For a GET request with a request extension of html, the script name may be html.esp or GET.esp.
-
-## Scripts for GET requests
-
-Apart for supporting scripts named after the request method, scripts handling GET and HEAD requests may be named differently for Sling to support a more elaborate processing order.
-
-Depending on whether request selectors are considered, a script may have two forms:
-
-* a. Ignoring request selectors (e.g. there are none in the request URI) `{resourceTypeLabel}.{requestExtension}.{scriptExtension}`
-* b. Handling request selectors `{selectorStringPath}.{requestExtension}.{scriptExtension}`
-
-The constituents of these script names are as follows:
-
-* `{resourceTypeLabel}` - The last path segment of the path created from the resource type. This part is optional if the `{requestExtension}` is used in the script name. The resource type might either be set via the `sling:resourceType` property on the accessed node or if that property is not there its primary node type (property `jcr:primaryType`) is taken as fallback.
-* `{requestExtension}` - The request extension. This part may be ommitted if the request extension is "html", otherwise this part is required. If this part is ommitted, the `{resourceTypeLabel}` is required in the case of ignoring the selectors.
-* `{scriptExtension}` - The extension, e.g. "esp" or "jsp", identifying the scripting langauage used.
-* `{selectorStringPath}` - The selector string converted to a path, along the lines of `selectorString.replace('.', '/')`. If less selectors are specified in the script name than given in the request, the script will only be taken into consideration if the given selectors are the **first** selectors in the request. This means *sel1/sel2.html.jsp* will be a candidate for the request url */content/test.sel1.sel2.sel3.html* but not for */content/test.sel3.sel1.sel2.html*. So the order of selectors is relevant!
-
-## Priority
-
-The rules for script path priorization is defined as follows:
-
-* The more request selectors are matched, the better
-* A script including the request extension matches better than one without a request extension (for html only)
-* A script found earlier matches better than a script found later in the processing order. This means, that script closer to the original resource type in the resource type hierarchy is considered earlier.
-
-## Examples
-
-Let's consider the following script paths for a request of a resource whose resource type is `slingsample` and the request selectors are *print.a4* and the request extension is *html*:
-
-* (0) GET.esp
-* (1) sample.esp
-* (2) html.esp
-* (3) print.esp
-* (4) print/a4.esp
-* (5) print.html.esp
-* (6) print/a4.html.esp
-* (7) a4.html.esp
-* (8) a4/print.html.esp
-
-The priority of script selection would be (starting with the best one): (6) - (4) - (5) - (3) - (2) - (1) - (0). Note that (4) is a better match than (5) because it matches more selectors even though (5) has an extension match where (4) does not. (7) is not a candidate because it does not include the first selector (print) and (8) is not a candidate because it has the wrong order of selectors.
http://git-wip-us.apache.org/repos/asf/sling-site/blob/7b703652/content/documentation/the-sling-engine/wrap-or-decorate-resources.md
----------------------------------------------------------------------
diff --git a/content/documentation/the-sling-engine/wrap-or-decorate-resources.md b/content/documentation/the-sling-engine/wrap-or-decorate-resources.md
deleted file mode 100644
index 0cc370f..0000000
--- a/content/documentation/the-sling-engine/wrap-or-decorate-resources.md
+++ /dev/null
@@ -1,39 +0,0 @@
-title=Wrap or Decorate Resources
-type=page
-status=published
-~~~~~~
-
-## Introduction
-
-The Sling API provides an easy way to wrap or decorate a resource before returning. Use cases for this could for example be
-* overwrite resource type/resource super type (for example based on the resource path)
-* add metadata
-
-##
-
-To add a resource decorator just register one or more services which implement the interface `ResourceDecorator`
-
-:::java
-interface ResourceDecorator {
-/** Optionally decorate the supplied Resource */
-Resource decorate(Resource)
-
-/** Only called if using older versions of Sling, see below */
-@Deprecated
-Resource decorate(Resource, HttpServletRequest)
-}
-
-
-The registered decorators will be called from the resource resolver for each resource returned.
-If the service decorates the resource it should return the new resource (often using a `ResourceWrapper` to wrap the original Resource).
-If the service does not want to decorate the resource, it should return the original resource or null.
-
-Starting with version 2.1.0 of the JCR Resource bundle, the two-argument `decorate` method is not called anymore.
-Implementors of this interface targeting both newer and older versions of this bundle are advised to implement this method as:
-
-:::java
-public Resource decorate(Resource resource, HttpServletRequest request) {
-return this.decorate(resource);
-}
-
-And use some other mechanism (e.g. a `ThreadLocal`) to obtain the current request if necessary.
http://git-wip-us.apache.org/repos/asf/sling-site/blob/7b703652/content/documentation/tutorials-how-tos.md
----------------------------------------------------------------------
diff --git a/content/documentation/tutorials-how-tos.md b/content/documentation/tutorials-how-tos.md
deleted file mode 100644
index bde31cb..0000000
--- a/content/documentation/tutorials-how-tos.md
+++ /dev/null
@@ -1,7 +0,0 @@
-title=Tutorials & How-Tos
-type=page
-status=published
-~~~~~~
-
-{% for label, page in children %}* [{{ page.headers.title }}]({{ page.path }})
-{% endfor %}
http://git-wip-us.apache.org/repos/asf/sling-site/blob/7b703652/content/documentation/tutorials-how-tos/46-line-blog.md
----------------------------------------------------------------------
diff --git a/content/documentation/tutorials-how-tos/46-line-blog.md b/content/documentation/tutorials-how-tos/46-line-blog.md
deleted file mode 100644
index b9af697..0000000
--- a/content/documentation/tutorials-how-tos/46-line-blog.md
+++ /dev/null
@@ -1,159 +0,0 @@
-title=46 Line Blog
-type=page
-status=published
-~~~~~~
-
-This tutorial is based on the first *Sling Gems* on dev.day.com: The [Sling gems: a blog in 46 lines of code](http://dev.day.com/microsling/content/blogs/main/sling-46-lines-blog.html). It has slightly been adapted to fit here.
-
-In this tutorial, the SlingPostServlet and the sling.js library are brought together using 46 (no kidding: *fourty-six*) lines of code to create a simple blog (or let's say *bloggish*) application.
-
-I used this example in my [Rapid JCR application development with Apache Sling](http://www.slideshare.net/bdelacretaz/rapid-jcr-applications-development-with-sling-1196003) presentation at ApacheCon US 09 in Oakland (slides will be available soon), and I think it's a good testimony to the power and simplicity of Sling.
-
-## Audience
-
-Although this is a simple sample, it requires some custom settings to work. If you're just starting with Sling, [Discover Sling in 15 minutes](/documentation/getting-started/discover-sling-in-15-minutes.html) might be a better choice.
-
-## Step 0: Start, configure and login to Sling
-
-See [Getting and Building Sling](/documentation/development/getting-and-building-sling.html) for how to start Sling. Start it on port 8888 for the below links to work.
-
-For this sample we need the optional *org.apache.sling.samples.path-based.rtp* bundle, if it's not present in the [OSGi console](http://localhost:8888/system/console/bundles), install and start it. That bundle is not released yet so you might need to build it yourself, from its [source](http://svn.apache.org/repos/asf/sling/trunk/samples/path-based-rtp). The bundle must then appear in the [OSGI console's list of bundles](http://localhost:8888/system/console/bundles), with name = *org.apache.sling.samples.path-based.rtp* and status = *Active*.
-
-Then, login using <http://localhost:8888/?sling:authRequestLogin=1> which should prompt you for a username and password, use *admin* and *admin*. Once that's done, <http://localhost:8888/index.html> should say *You are currently logged in as user *admin* to workspace *default**.
-
-## Step 1: Creating content
-
-The easiest way to create content in Sling is to use an HTTP POST request, let's use a simple HTML form:
-
-<html>
-<body>
-<h1>Sling microblog</h1>
-
-<div>
-<form method="POST">
-<input type="text" name="title" style="width:100%"/>
-
-<br/>Text:<br/>
-<textarea style="width:100%" name="text"></textarea>
-
-<br/>
-<input type="submit" value="save"/>
-<input type="hidden" name=":redirect" value="*.html"/>
-
-<!-- used by Sling when decoding request parameters -->
-<input type="hidden" name="_charset_" value="UTF-8"/>
-</form>
-</div>
-
-<!-- code of step 2 comes here -->
-</body>
-</html>
-
-
-That's two input fields, a submit button and a hidden field that tells Sling what to do after the POST (in this case: redirect to the html view of the node that was just created).
-
-To test the form, start Sling and save the above script as {{/apps/blog/blog.esp}} [^esp] in the Sling repository - a WebDAV mount is the easiest way to do that. Browsing to <http://localhost:8888/content/blog/*.html> [^port] should display the above form.
-
-[^esp]: ESP is Sling's server-side javascript language
-[^port]: This assumes your instance of Sling is running on port 8888. If that's not the case, adjust the example URLs accordingly.
-
-Input some data (using "foo" for the title, for the sake of our examples below), save the form, and Sling should display the form again, using the URL of the node that was just created.
-
-<div class="note">
-If you get an error saying _javax.jcr.AccessDeniedException: ...not allowed to add or modify item_ it means that you are not logged in as user _admin_. See instructions above for logging in.
-</div>
-
-At this point you're probably looking at an empty form with an URL ending in _foo_, if you used that for the title. Or _foo_0_ or _foo_1_ if other _foo_s already existed. Don't worry about not seeing your content, we'll fix that right away.
-
-
-## Step 2: Where's my content?
-
-To verify that our content has been created, we can have a look at the JSON data at <http://localhost:8888/content/blog/foo.tidy.json>, which should display our new node's values:
-
-
-{
-"jcr:primaryType": "nt:unstructured",
-"text": "This is the foo text",
-"title": "foo"
-}
-
-
-That's reassuring, but what we really want is for these values to be displayed on the editing form for our post.
-
-Thanks to the *sling.js* client library, we just need to add a `Sling.wizard()` call to our form to display those values. Let's first add a `<head>` element to our form to load the *sling.js* library, before the existing `<body>` of course:
-
-<head>
-<script src="/system/sling.js"></script>
-</head>
-
-
-And add the `Sling.wizard()` after the form, where we had the _code of step 2 comes here_ comment:
-
-<!-- code of step 2 comes here -->
-<script>Sling.wizard();</script>
-
-
-Reloading the form at `http://localhost:8888/content/blog/*.html` and creating a new post should now redirect to an editable version of the post, with the form fields correctly initialized.
-
-We can now create and edit posts; let's add some navigation, using more of the *sling.js* functionality.
-
-## Step 3: Navigation
-
-The *sling.js* library provides utilities to access and manipulate content. For our blog, we'll use the `getContent(path)` method to list the siblings of the current node.
-
-Add the following code to your script, after the `Sling.wizard()` call that was added in step 2:
-
-<h3>Navigation</h3>
-<ul>
-<li><em><a href="/content/blog/*.html">[Create new post]</a></em></li>
-<script>
-var posts = Sling.getContent("/content/blog", 2);
-for(var i in posts) {
-document.write("<li>"
-+ "<a href='/content/blog/" + i + ".html'>"
-+ posts[i].title
-+ "</a></li>");
-}
-</script>
-</ul>
-
-
-The first link to `/content/blog/*` brings us back to our content creating form, which is nothing else than the editing form reading empty values and posting to the "magic star" URL.
-
-The rest of the javascript runs client-side, as it is not embedded in `<% %>` code markers, calls the `sling.getContent` method to get two levels of node data below `/content/blog`, and displays links to nodes that it finds.
-
-That's a basic navigation, of course, in a real blog we'd need some paging and contextualization to cope with large numbers of posts.
-
-Nevertheless, with this addition our ESP script allows us to create, edit and navigate blog posts - not bad for 46 lines of code, including comments, whitespace and output formatting.
-
-
-## Step 4: Data first, structure later
-
-You might have heard this mantra, which we apply in many areas of Sling.
-
-In this case, adding a new field to our blog posts could not be easier: just add an input field to the form, and Sling will do the rest.
-
-Adding this inside our script's `<form>` element, for example:
-
-<br/>Author:<br/>
-<input type="author" name="author" style="width:100%"/>
-
-
-Allows us to add an author name to our blog posts. No need to define anything at the repository level, as Sling is using it in unstructured mode in this case, and no need to migrate existing data, the author field of existing posts will simply be empty.
-
-
-## I want my ESP!
-
-Now wait...we said we were going to create an ESP script, but our "application" is just static HTML and some client javascript at this point.
-
-That's correct - as we are using only Sling client-facing features at this point (HTTP POST and `sling.js`), we do not necessarily need to use ESP code.
-
-To keep things simple, we'll refrain from adding ESP-based features at this point, but you can of course use any ESP code in the *blog.esp* "script".
-
-
-## That's the power of Sling
-
-The 46-line blog is a good example of the power of Sling. It leverages the [SlingPostServlet](/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.html), which handles POST requests in a form-friendly way, and the [`sling.js`](http://svn.apache.org/repos/asf/sling/trunk/bundles/servlets/post/src/main/resources/system/sling.js) client library, which provides high-level functionality on the client side.
-
-///Footnotes Go Here///
-
http://git-wip-us.apache.org/repos/asf/sling-site/blob/7b703652/content/documentation/tutorials-how-tos/DropBoxEventHandler.java
----------------------------------------------------------------------
diff --git a/content/documentation/tutorials-how-tos/DropBoxEventHandler.java b/content/documentation/tutorials-how-tos/DropBoxEventHandler.java
deleted file mode 100644
index 099415e..0000000
--- a/content/documentation/tutorials-how-tos/DropBoxEventHandler.java
+++ /dev/null
@@ -1,82 +0,0 @@
-
-package mypackage;
-
-import javax.jcr.Session;
-
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
-import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.resource.ResourceResolver;
-import org.apache.sling.api.resource.ResourceResolverFactory;
-import org.apache.sling.event.jobs.Job;
-import org.apache.sling.event.jobs.consumer.JobConsumer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * The <code>DropBoxEventHandler</code> moves files posted to /tmp/dropbox to the appropriate locations:
- * images (MIME type: image/png) to /dropbox/images/
- * music (MIME type: audio/mpeg) to /dropbox/music/
- * movies (MIME type: video/x-msvideo) to /dropbox/movies/
- * otherwise to /dropbox/other/
- *
- */
-@Component
-@Service(value=JobConsumer.class)
-@Property(name=JobConsumer.PROPERTY_TOPICS, value=DropBoxService.JOB_TOPIC)
-public class DropBoxEventHandler implements JobConsumer {
-
- /** Default logger. */
- protected final Logger logger = LoggerFactory.getLogger(this.getClass());
-
- @Reference
- private ResourceResolverFactory resolverFactory;
-
- private final static String IMAGES_PATH = "/dropbox/images/";
- private final static String MUSIC_PATH = "/dropbox/music/";
- private final static String MOVIES_PATH = "/dropbox/movies/";
- private final static String OTHER_PATH = "/dropbox/other/";
-
- @Override
- public JobResult process(final Job job) {
- ResourceResolver adminResolver = null;
- try {
- adminResolver = resolverFactory.getAdministrativeResourceResolver(null);
-
- final String resourcePath = (String) job.getProperty("resourcePath");
- final String resourceName = resourcePath.substring(resourcePath.lastIndexOf("/") + 1);
-
- final Resource res = adminResolver.getResource(resourcePath);
- if ( res.isResourceType("nt:file") ) {
- final String mimeType = res.getResourceMetadata().getContentType();
- String destDir;
- if (mimeType.equals("image/png")) {
- destDir = IMAGES_PATH;
- }
- else if (mimeType.equals("audio/mpeg")) {
- destDir = MUSIC_PATH;
- }
- else if (mimeType.equals("video/x-msvideo")) {
- destDir = MOVIES_PATH;
- }
- else {
- destDir = OTHER_PATH;
- }
- final Session adminSession = adminResolver.adaptTo(Session.class);
- adminSession.move(resourcePath, destDir + resourceName);
- adminSession.save();
- logger.info("The file {} has been moved to {}", resourceName, destDir);
- }
- return JobResult.OK;
- } catch (final Exception e) {
- logger.error("Exception: " + e, e);
- return JobResult.FAILED;
- } finally {
- if (adminResolver != null) {
- adminResolver.close();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sling-site/blob/7b703652/content/documentation/tutorials-how-tos/DropBoxService.java
----------------------------------------------------------------------
diff --git a/content/documentation/tutorials-how-tos/DropBoxService.java b/content/documentation/tutorials-how-tos/DropBoxService.java
deleted file mode 100644
index b791e5f..0000000
--- a/content/documentation/tutorials-how-tos/DropBoxService.java
+++ /dev/null
@@ -1,53 +0,0 @@
-
-package mypackage;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
-import org.apache.sling.api.SlingConstants;
-import org.apache.sling.event.jobs.JobManager;
-import org.osgi.service.event.Event;
-import org.osgi.service.event.EventConstants;
-import org.osgi.service.event.EventHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * The <code>DropBoxService</code> is listening content added to /tmp/dropbox by using OSGI events
- *
- */
-@Component(immediate=true)
-@Service(value=EventHandler.class)
-@Property(name=EventConstants.EVENT_TOPIC, value=SlingConstants.TOPIC_RESOURCE_ADDED)
-public class DropBoxService implements EventHandler {
-
- /** Default logger. */
- protected final Logger logger = LoggerFactory.getLogger(this.getClass());
-
- /** The job manager for starting the jobs. */
- @Reference
- private JobManager jobManager;
-
- /** The job topic for dropbox job events. */
- public static final String JOB_TOPIC = "com/sling/eventing/dropbox/job";
-
- @Override
- public void handleEvent(final Event event) {
- // get the resource event information
- final String propPath = (String) event.getProperty(SlingConstants.PROPERTY_PATH);
- final String propResType = (String) event.getProperty(SlingConstants.PROPERTY_RESOURCE_TYPE);
- // a job is started if a file is added to /tmp/dropbox
- if ( propPath.startsWith("/tmp/dropbox") && "nt:file".equals(propResType) ) {
- // create payload
- final Map<String, Object> payload = new HashMap<String, Object>();
- payload.put("resourcePath", propPath);
- // start job
- this.jobManager.addJob(JOB_TOPIC, payload);
- logger.info("the dropbox job has been started for: {}", propPath);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sling-site/blob/7b703652/content/documentation/tutorials-how-tos/getting-resources-and-properties-in-sling.md
----------------------------------------------------------------------
diff --git a/content/documentation/tutorials-how-tos/getting-resources-and-properties-in-sling.md b/content/documentation/tutorials-how-tos/getting-resources-and-properties-in-sling.md
deleted file mode 100644
index 72f67e3..0000000
--- a/content/documentation/tutorials-how-tos/getting-resources-and-properties-in-sling.md
+++ /dev/null
@@ -1,98 +0,0 @@
-title=Getting Resources and Properties in Sling
-type=page
-status=published
-~~~~~~
-
-
-The Resource is one of the central parts of Sling. Extending from JCR's Everything is Content, Sling assumes Everthing is a Resource. Thus Sling is maintaining a virtual tree of resources, which is a merger of the actual contents in the JCR Repository and resources provided by so called resource providers. By doing this Sling fits very well in the paradigm of the REST architecture.
-
-In this article we will explore a few ways to programmatically map a resource path (String) to a resource object (Resource) and its properties in Sling, from within an OSGI service, a servlet and a JSP.
-
-The whole game consists in first getting a `ResourceResolver` and then getting the `Resource` itself.
-
-## Within an OSGI Service/Compoment
-
-You can access a resource through the `ResourceResolverFactory` service:
-
-#!java
-@Reference
-private ResourceResolverFactory resolverFactory;
-
-public void myMethod() {
-try {
-String resourcePath = "path/to/resource";
-ResourceResolver resourceResolver = resolverFactory.getAdministrativeResourceResolver(null);
-Resource res = resourceResolver.getResource(resourcePath);
-// do something with the resource
-// when done, close the ResourceResolver
-resourceResolver.close();
-} catch (LoginException e) {
-// log the error
-}
-}
-
-
-
-## Within a Servlet
-
-You can access the resource defined by the request URL through the `SlingHttpServletRequest`:
-
-#!java
-// req is the SlingHttpServletRequest
-Resource res = req.getResource();
-
-
-You can access any resource by first accessing the `ResourceResolver`:
-
-#!java
-String resourcePath = "path/to/resource";
-// req is the SlingHttpServletRequest
-ResourceResolver resourceResolver = req.getResourceResolver();
-Resource res = resourceResolver.getResource(resourcePath);
-
-
-## Within a JSP file
-
-When you use the `<sling:defineObjects>` tag in a JSP file, you have access to a few handy objects, one of them is `resource`, the resource that is resolved from the URL. Another one is `resourceResolver`, the `ResourceResolver` defined through the `SlingHttpServletRequest`.
-
-To access a resource:
-
-#!jsp
-<sling:defineObjects>
-<%
-String resourcePath = "path/to/resource";
-Resource res = resourceResolver.getResource(resourcePath);
-%>
-
-
-If needed you can adapt a Sling Resource to a JCR Node:
-
-#!java
-Node node = resource.adaptTo(Node.class);
-
-
-Note: `resource.adaptTo(Node.class)` may return null if the resource is not backed by a JCR node. This is particularly the case for `NonExistingResource` resources or resource provided by a non-JCR resource provider.
-
-## Accessing a Property
-
-The `ValueMap` is an easy way to access properties of a resource. With most resources you can use `Adaptable.adaptTo(Class)` to adapt the resource to a value map:
-
-#!java
-// res is the Resource
-ValueMap properties = res.adaptTo(ValueMap.class);
-
-
-You can also access the properties through the `ResourceUtil` utility class:
-
-#!java
-// res is the Resource
-ValueMap properties = ResourceUtil.getValueMap(res);
-
-
-Then, to access a specific String property called `propName`:
-
-#!java
-String rule = properties.get(propName, (String) null);
-
-
-For more details about resources and how to access them in Sling, you can refer to the [Sling documentation about Resources](/documentation/the-sling-engine/resources.html).