Return-Path: X-Original-To: apmail-sling-commits-archive@www.apache.org Delivered-To: apmail-sling-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3B342DA4F for ; Wed, 12 Dec 2012 09:16:50 +0000 (UTC) Received: (qmail 39860 invoked by uid 500); 12 Dec 2012 09:16:50 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 39789 invoked by uid 500); 12 Dec 2012 09:16:49 -0000 Mailing-List: contact commits-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list commits@sling.apache.org Received: (qmail 39780 invoked by uid 99); 12 Dec 2012 09:16:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Dec 2012 09:16:48 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Dec 2012 09:16:31 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 8F9652388CAD; Wed, 12 Dec 2012 09:15:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1420577 [28/30] - in /sling/site/trunk/content/site: ./ 46-line-blog.data/ authentication.data/ documentation.data/ first-steps.data/ getting-and-building-sling.data/ how-to-manage-events-in-sling.data/ index.data/ links.data/ manipulating... Date: Wed, 12 Dec 2012 09:14:44 -0000 To: commits@sling.apache.org From: cziegeler@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121212091507.8F9652388CAD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: sling/site/trunk/content/site/the-sling-engine.html URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/the-sling-engine.html?rev=1420577&view=auto ============================================================================== --- sling/site/trunk/content/site/the-sling-engine.html (added) +++ sling/site/trunk/content/site/the-sling-engine.html Wed Dec 12 09:13:50 2012 @@ -0,0 +1,106 @@ + + + + + Apache Sling - The Sling Engine + + + + + +
+ +
+ + Apache + +
+
+ +
+ +

The Sling Engine

+ +

General

+ + + +

Request Handling

+ + + + +

Resources

+ + + + +

Misc

+ + + +
+Last modified by fmeschbe on 2011-02-06 08:05:15.0 +
+
+Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners. +
+
+ + + Propchange: sling/site/trunk/content/site/the-sling-engine.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: sling/site/trunk/content/site/the-sling-engine.html ------------------------------------------------------------------------------ svn:keywords = Id Propchange: sling/site/trunk/content/site/the-sling-engine.html ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: sling/site/trunk/content/site/the-sling-launchpad.html URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/the-sling-launchpad.html?rev=1420577&view=auto ============================================================================== --- sling/site/trunk/content/site/the-sling-launchpad.html (added) +++ sling/site/trunk/content/site/the-sling-launchpad.html Wed Dec 12 09:13:50 2012 @@ -0,0 +1,386 @@ + + + + + Apache Sling - The Sling Launchpad + + + + + +
+ +
+ + Apache + +
+
+ +
+ +

The Sling Launchpad

+ + + +

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 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. 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.
  • +
  • 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 terminates 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)
-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
  2. +
  3. The sling.home system property
  4. +
  5. The SLING_HOME environment variable
  6. +
  7. If none of the above resolves to a non-null value, the default value of sling is assumed
  8. +
+ + + +

Control Port

+ +

When starting the Sling Standalone Application with the start command line option, a TCP port is opened. The interface and port is configurable with the -j command line option. The address of the interface and the actual 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 is just read from this 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 only created if the application is started with the start command line option. If this option is omitted – the default – the server side socket is not created and the Sling Standalone Application instance cannot be remotely controlled.
  • +
  • The default host name for the socket 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.
  • +
  • In addition to the IP address and port on which the control port is listening a nonce is written to the controlport file. Any interaction with the server on the control port must include this none.
  • +
+ + +

Suggestions:

+
    +
  • Do not allow the control port to be opened on an externally visible interface. Using the localhost/127.0.0.1 is just sufficient.
  • +
  • Make sure only legitimate users have access to the installation folder of Sling (${sling.home}).
  • +
+ + + +

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 cascaded 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 Bundles

+ +

The second project we want to look at is the Launchpad Bundles project. This is a very simple project in that it only collects together a number of OSGi bundles, which will make up the final application. The bundles are stored in a (big) Java Archive in folders whose path is formed with resources/9 where 9 is a start level which is assigned to the bundles as they are installed. The special start level 0 instructs the installer to not actually assign a specific start level to the bundles contained in that folder.

+ +

Currently the following start level assignement is used by the Launchpad Bundles project:

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Start Level Bundle Group Bundle(s)
1 Basic bundles required for the correct operation of Sling org.apache.sling.commons.log
5 Apache Felix Web Console org.apache.felix.bundlerepository, org.apache.felix.webconsole, org.apache.sling.extensions.threaddump
10 OSGi Compendium Service Implementations org.apache.felix.configadmin, org.apache.felix.eventadmin, org.apache.felix.metatype, org.apache.felix.scr
15 JCR Repository (Jackrabbit) commons-collections, commons-io-1.4.jar
+commons-lang, jackrabbit-api, jackrabbit-jcr-commons, org.apache.sling.commons.mime, org.apache.sling.commons.osgi, org.apache.sling.jcr.api, org.apache.sling.jcr.base, org.apache.sling.jcr.jackrabbit.server, org.apache.sling.jcr.webdav
0 Actual Sling Application bundles org.apache.sling.adapter, org.apache.sling.api, org.apache.sling.bundleresource.impl, org.apache.sling.commons.json, org.apache.sling.engine, org.apache.sling.extensions.apt.parser, org.apache.sling.extensions.apt.servlet, org.apache.sling.httpauth, org.apache.sling.jcr.classloader, org.apache.sling.jcr.contentloader, org.apache.sling.jcr.ocm, org.apache.sling.jcr.resource, org.apache.sling.launchpad.content, org.apache.sling.samples.path-based.rtp, org.apache.sling.scripting.api, org.apache.sling.scripting.core, org.apache.sling.scripting.javascript, org.apache.sling.scripting.jsp, org.apache.sling.scripting.jsp.taglib, org.apache.sling.servlets.get, org.apache.sling.servlets.post, org.apache.sling.servlets.resolver
+
+ + + + +

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
  • +
  • Take the Launchpad Bundles artifact and unpack it
  • +
  • Finally pack all together into a single big JAR or WAR file
  • +
+ + +

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 2.4 (or later) compliant servlet container.

+
+Last modified by fmeschbe on Sat May 19 18:35:07 EDT 2012 +
+
+Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners. +
+
+ + + Propchange: sling/site/trunk/content/site/the-sling-launchpad.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: sling/site/trunk/content/site/the-sling-launchpad.html ------------------------------------------------------------------------------ svn:keywords = Id Propchange: sling/site/trunk/content/site/the-sling-launchpad.html ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: sling/site/trunk/content/site/thoughts-on-release-management.html URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/thoughts-on-release-management.html?rev=1420577&view=auto ============================================================================== --- sling/site/trunk/content/site/thoughts-on-release-management.html (added) +++ sling/site/trunk/content/site/thoughts-on-release-management.html Wed Dec 12 09:13:50 2012 @@ -0,0 +1,137 @@ + + + + + Apache Sling - Thoughts on Release Management + + + + + +
+ +
+ + Apache Incubator + +
+
+ +
+

Thoughts on Release Management

+ + + +

Status: DRAFT
+Created: 3. January 2008
+Author: fmeschbe

+ + +

As we should start thinking about making an initial release of Sling, we should discuss a few issues:

+ +
    +
  1. How do number releases ?
  2. +
  3. What do we release ?
  4. +
  5. When do we release ?
  6. +
+ + +

In this concept I propose a version numbering scheme as well as my idea for the contents of an initial Sling release and how to release in the future. Comments are very welcome.

+ + +

Version Numbers

+ +

Maven has a very nice concept of SNAPSHOT versions. In this concept, a version just has a -SNAPSHOT suffix which marks the version as a SNAPSHOT (or non-release) version. OSGi versions on the other hand are simply 4-position numbers, where the parts are separated by dots, first three parts (major, minor, micro) must be numeric and the last part (qualifier) may also contain characters. The Apache Felix Maven Bundle Plugin we use to build the Sling bundles converts Maven version numbers to correct OSGi version numbers. For example, the version 2.0.0-incubator-SNAPSHOT is converted to 2.0.0.incubator-SNAPSHOT.

+ +

The consequence of this conversion is that a SNAPSHOT version (e.g. 2.0.0.incubator-SNAPSHOT) would always be assumed more recent than the corresponding release version (2.0.0.incubator in this example). Instead of just do hackery with the release version, such as adding a different suffix, I propose the following version numbering concept:

+ +
    +
  1. Odd micro versions are always SNAPSHOTs, e.g. 2.0.1-SNAPSHOT
  2. +
  3. Even micro versions are always releases, e.g. 2.0.2
  4. +
+ + +

This way, a release is always more recent than the latest SNAPSHOT from which the release was built. This also means, that there is never an official release with an even micro version and there will never be an "official" SNAPSHOT with an even micro version. Thus both 2.0.2-SNAPSHOT and 2.0.3 would be incorrect version numbers.

+ +

So, when releasing project, the minor version of the release is the next increment to the current SNAPSHOT micro version. The new SNAPSHOT micro version is again the next increment of the release version. For example to release the current SNAPSHOT 2.0.3-SNAPSHOT, the following version numbers are used:

+ +
    +
  • Current SNAPSHOT version: 2.0.3-SNAPSHOT
  • +
  • Release version: 2.0.4
  • +
  • Next SNAPSHOT version: 2.0.5-SNAPSHOT
  • +
+ + + +

The same mechanism applies when we decide to increment the minor or even the major version number: Up to the release, the SNAPSHOT remains with the former minor (or major) version and only on release, are the version numbers incremented. For example to release the current SNAPSHOT 2.0.7-SNAPSHOT as 2.1.0, the following numbering is used:

+ +
    +
  • Current SNAPSHOT version: 2.0.7-SNAPSHOT
  • +
  • Release version: 2.1.0
  • +
  • Next SNAPSHOT version: 2.1.1-SNAPSHOT
  • +
+ + + +

For branching, the branch always gets an incremented minor version number. For example when branching off 2.1.1-SNAPSHOT the branch version would be 2.2.1-SNAPSHOT. The problem then is: What would be the next minor version if 2.1.1-SNAPSHOT would be released with an incremented minor version ? One solution could be to not only define the branch version number but to also increment the trunk minor version to the next minor version. In the example, this would raise the trunk version number to 2.3.1-SNAPSHOT (from 2.1.1-SNAPSHOT). Alternatively, we may just append a suffix indicating the branch, such as 2.1.1.branch-SNAPSHOT.

+ +

Both solutions actually have their drawbacks and maybe we never even need this, because I cannot imagine requiring a branch. The reason for this assumption is, that we release "small" bundles, which may easily and quickly be fixed and fix release be provided equally quickly.

+ + +

Releases of Sling

+ +

For a starter we will have an initial release of Sling. This release will most probably encompass the following constituents:

+ +
    +
  • A standalone Java Application consisting of a single JAR file (or a ZIP) containing all bundles used by Sling
  • +
  • A web application (WAR file) containing all bundles used by Sling
  • +
  • All bundles packed into the standalone and web applications
  • +
  • The parent POM
  • +
+ + +

After the initial release, further releases will only be made of single bundle (or a small number of bundles). Whenever we see a release fit, we will cut it. Some bundles will have longer and some bundles will have shorter release cycles. This all depends on the importance of the fixes and/or the enhancements applied as well as the needs by the user community.

+ + +

Packaged Bundle Releases

+ +

For end users and beginners it is very helpfull to have completely package Sling application (or web application) in their hands to try it out and start build web applications. In addition, such prepackaging also serves well for prototype building and "just testing it".

+ +

For this reason, there will be packaged releases of the standalone and web application once or twice a year. These applications though would just be packagings of already released bundles.

+ + +

Referring to other Sling Projects

+ +

Most Sling projects depend on other Sling projects. After the initial release all Sling projects should only refer to other Sling projects by their release number. Only, if a projects uses non-released functionality of another project, should the SNAPSHOT version be referred to.

+ +

Also, the release of a Sling project will not cause the dependencies of Sling projects using the released project to be incremented. That is, each Sling project always refers to the smallest possible version number of other Sling projects.

+ +

This helps managing the dependency tree and prevents needless upgrades of bundles in running systems.

+
+ + + Propchange: sling/site/trunk/content/site/thoughts-on-release-management.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: sling/site/trunk/content/site/thoughts-on-release-management.html ------------------------------------------------------------------------------ svn:keywords = Id Propchange: sling/site/trunk/content/site/thoughts-on-release-management.html ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: sling/site/trunk/content/site/thread-handling.html URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/thread-handling.html?rev=1420577&view=auto ============================================================================== --- sling/site/trunk/content/site/thread-handling.html (added) +++ sling/site/trunk/content/site/thread-handling.html Wed Dec 12 09:13:50 2012 @@ -0,0 +1,63 @@ + + + + + Apache Sling - Thread Handling + + + + + +
+ +
+ + Apache Incubator + +
+
+ +
+ +

Thread Handling

+ +

The Sling Threads module provides the concept of thread pools to manage per application thread pools.
+A thread pool manages a set of threads.

+ +

The module is based on the JDK 1.5 thread factory.

+ +

TBD

+
+Last modified by cziegeler@apache.org on 2008-02-18 07:12:03.0 +
+
+ + + Propchange: sling/site/trunk/content/site/thread-handling.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: sling/site/trunk/content/site/thread-handling.html ------------------------------------------------------------------------------ svn:keywords = Id Propchange: sling/site/trunk/content/site/thread-handling.html ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: sling/site/trunk/content/site/tutorials-how-tos.html URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/tutorials-how-tos.html?rev=1420577&view=auto ============================================================================== --- sling/site/trunk/content/site/tutorials-how-tos.html (added) +++ sling/site/trunk/content/site/tutorials-how-tos.html Wed Dec 12 09:13:50 2012 @@ -0,0 +1,71 @@ + + + + + Apache Sling - Tutorials & How-Tos + + + + + +
+ +
+ + Apache + +
+
+ +
+ +

Tutorials & How-Tos

+ + +
+Last modified by mykee on 2009-06-01 08:18:50.0 +
+
+Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners. +
+
+ + + Propchange: sling/site/trunk/content/site/tutorials-how-tos.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: sling/site/trunk/content/site/tutorials-how-tos.html ------------------------------------------------------------------------------ svn:keywords = Id Propchange: sling/site/trunk/content/site/tutorials-how-tos.html ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: sling/site/trunk/content/site/url-decomposition.html URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/url-decomposition.html?rev=1420577&view=auto ============================================================================== --- sling/site/trunk/content/site/url-decomposition.html (added) +++ sling/site/trunk/content/site/url-decomposition.html Wed Dec 12 09:13:50 2012 @@ -0,0 +1,204 @@ + + + + + Apache Sling - URL decomposition + + + + + +
+ +
+ + Apache + +
+
+ +
+ +

URL decomposition

+ +

During the Resource Resolution step, the client request URL is decomposed into the following parts:

+ +
    +
  1. Resource Path - The longest substring of the request URL such that the resource path is either the complete request URL or the next character in the request URL after the resource path is a dot (.).
  2. +
  3. 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. If the resource path spans the complete request URL no seletors exist. If only one dot follows the resource path before the end of the request URL or the next slash, also no selectors exist.
  4. +
  5. 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.
  6. +
  7. Suffix Path - 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 resource path.
  8. +
+ + +

There's a cheat sheet on Day's dev page under http://dev.day.com/content/docs/en/cq/current/developing/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/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 and examples
The SlingRequestPathInfoTest demonstrates and tests this decomposition. Feel free to suggest additional tests that help clarify how this works!
+ +
+Last modified by edn on 2011-07-16 11:22:49.0 +
+
+Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners. +
+
+ + + Propchange: sling/site/trunk/content/site/url-decomposition.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: sling/site/trunk/content/site/url-decomposition.html ------------------------------------------------------------------------------ svn:keywords = Id Propchange: sling/site/trunk/content/site/url-decomposition.html ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: sling/site/trunk/content/site/usecases.html URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/usecases.html?rev=1420577&view=auto ============================================================================== --- sling/site/trunk/content/site/usecases.html (added) +++ sling/site/trunk/content/site/usecases.html Wed Dec 12 09:13:50 2012 @@ -0,0 +1,74 @@ + + + + + Apache Sling - UseCases + + + + + +
+ +
+ + Apache Incubator + +
+
+ +
+

Use Cases for Sling

+ +

This page lists some use cases for Sling.

+ + +

Wiki

+ +

Day built a Wiki system on Sling. Each Wiki page is a node (with optional child nodes) in the repository. As a page is requested, the respective node is accessed and through the applying Component is rendered.

+ +

Thanks to the JCR Mapping and the resolution of the Component from the mapped Content, the system does not care for what actual node is addressed as long as there is a Content mapping and a Component capable of handling the Content.

+ +

Thus in the tradition of REST, the attachement of a Wiki page, which happens to be in a node nested below the wiki page node is easily accessed using the URL of the wiki page attaching the relative path of the attachement ode. The system resolves the URL to the attachement Content and just calls the attachement's Component to spool the attachement.

+ + + +

Digital Asset Management

+ +

Day has implemented a Digital Asset Management (DAM) Application based on Sling. Thanks to the flexibility of the Content/Component combo as well as the service registration/access functionality offered by OSGi, extending DAM for new content type is merely a matter of implementing one or two interfaces and registering the respective service(s).

+ +

Again, the managed assets may be easily spooled by directly accessing them.

+ + + +

Web Content Management

+ +

Last but not least, Sling offers itself very well to implementing a Web Content Management system. Thanks to the flexibility of rendering the output - remmber: the system does not care what to render, as long as the URL resolves to a Content object for which a Component exists, which is called to render the Content - providing support for Web Content authors (not PHP programmers but users out in the field) to build pages to their likings can easily be done.

+
+ + + Propchange: sling/site/trunk/content/site/usecases.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: sling/site/trunk/content/site/usecases.html ------------------------------------------------------------------------------ svn:keywords = Id Propchange: sling/site/trunk/content/site/usecases.html ------------------------------------------------------------------------------ svn:mime-type = text/plain