Title: Discover Sling in 15 minutes The Sling Launchpad is a ready-to-run Sling configuration, providing an embedded JCR content repository and web server, a selection of Sling components, documentation and examples. The Launchpad makes it easy to get started with Sling and to develop script-based applications. This page will help you get started with the Launchpad. Fifteen minutes should be enough to get an overview of what Sling does. While simple to run and understand, the Launchpad is a full-featured instance of Sling, an example configuration that we have created with the most common modules and configurations. The full functionality of Sling is available by loading additional Sling (or custom) OSGi bundles as needed, using the Launchpad's web-based OSGi management console. [TOC] ## See Also More Sling samples can be found under [http://svn.apache.org/repos/asf/sling/trunk/samples/](http://svn.apache.org/repos/asf/sling/trunk/samples/) Once you grok the basic examples of this page, we recommend studying the *slingbucks* and *espblog* samples. Both have README files with more info. ## Prerequisites We'll start with the self-runnable jar from the Sling distribution, you only need a Java 7 JDK. Download the latest release from the Sling [Downloads](/downloads.cgi) page or by clicking this link: [org.apache.sling.launchpad-8.jar](http://www.apache.org/dyn/closer.lua/sling/org.apache.sling.launchpad-8.jar). Alternatively you can deploy the [Sling Web application](http://www.apache.org/dyn/closer.lua/sling/org.apache.sling.launchpad-8-webapp.war) into any decent Servlet Container such as Jetty or Tomcat or you can [build the current source yourself]({{ refs.getting-and-building-sling.path }}). To show the simplicity of the REST-style approach taken by Sling the examples below will be using [cURL](http://curl.haxx.se/). Any HTTP client would do, but cURL is the easiest to document in a reproducible way. A WebDAV client makes editing server-side scripts much more convenient, but to make our examples easy to reproduce, we're using cURL below to create and update files in the JCR repository, via the Sling WebDAV server. ## Start the Launchpad After downloading the Sling Launchpad self-runnable jar just start it as follows: $ java -jar org.apache.sling.launchpad-8.jar This starts the Sling embedded Web Server on port 8080 and writes application files into the `sling` folder found in the current working directory. Once started, look at [http://localhost:8080/system/console/bundles](http://localhost:8080/system/console/bundles) with your browser. Use *admin* with password *admin* if Sling asks you for a login. Sling then displays the *Felix Web Management Console* page. On the bundles page, all bundles should be marked *Active*. They're all [OSGi](http://www.osgi.org/) bundles powered by [Apache Felix](http://felix.apache.org), but that doesn't really matter to us right now. *Log files: If things go wrong, have a look at the `sling/logs/error.log` log file \- that's where Sling writes any error messages.* ## Create some content Until we have ready-to-test forms, you can create content with cURL, or you can create an HTML form that posts to the specified URL. To create a content node (nodes are a [JCR](http://jackrabbit.apache.org/) concept, a unit of storage) with cURL, use: curl -u admin:admin -F"sling:resourceType=foo/bar" -F"title=some title" http://localhost:8080/content/mynode The resulting node can be seen at [http://localhost:8080/content/mynode.html](http://localhost:8080/content/mynode.html.path), or as json format under [http://localhost:8080/content/mynode.json](http://localhost:8080/content/mynode.json). Lets try with cURL: $ curl http://localhost:8080/content/mynode.json This returns the properties of the `/content/mynode` in JSON format as we have created it above. {"title":"some title","sling:resourceType":"foo/bar","jcr:primaryType":"nt:unstructured"} The additional property `jcr:primaryType` is a special JCR property added by the content repository, indicating the JCR primary node type. *Monitoring requests: Sling provides a simple tool (an OSGi console plugin) to monitor HTTP requests, which helps understand how things work internally. See the [Monitoring Requests]({{ refs.monitoring-requests.path }}) page for details.* ## Render your content using server-side javascript (ESP) Sling uses scripts or servlets to render and process content. Several scripting languages are available as additional Sling modules (packaged as OSGi *bundles* that can be installed via the Sling management console), but the launchpad currently includes the ESP (server-side ECMAscript), JSP (Java Server Pages), and Groovy language modules by default. To select a script, Sling uses the node's *sling:resourceType* property, if it is set. That is the case in our example, so the following script will be used by Sling to render the node in HTML, if the script is found at */apps/foo/bar/html.esp* in the repository.
<%= currentNode.headline %>