incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1420577 [11/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 GMT
Added: sling/site/trunk/content/site/form-based-authenticationhandler.html
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/form-based-authenticationhandler.html?rev=1420577&view=auto
==============================================================================
--- sling/site/trunk/content/site/form-based-authenticationhandler.html (added)
+++ sling/site/trunk/content/site/form-based-authenticationhandler.html Wed Dec 12 09:13:50 2012
@@ -0,0 +1,274 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<HTML>
+  <HEAD>
+    <TITLE>Apache Sling - Form Based AuthenticationHandler</TITLE>
+    <LINK rel="stylesheet" href="http://sling.apache.org/site/media.data/site.css" type="text/css" media="all">
+    <LINK rel="icon" href="http://sling.apache.org/site/media.data/favicon.ico">
+    <META http-equiv="Content-Type" content="text/html;charset=UTF-8">
+  </HEAD>
+  <BODY>
+    <DIV class="title">
+      <DIV class="logo">
+        <A href="http://sling.apache.org/site/index.html">
+          <IMG border="0" alt="Apache Sling" src="http://sling.apache.org/site/media.data/logo.png">
+        </A>
+      </DIV>
+      <DIV class="header">
+        <A href="http://www.apache.org/">
+          <IMG border="0" alt="Apache" src="http://sling.apache.org/site/media.data/apache.png">
+        </A>
+      </DIV>
+    </DIV>
+    <DIV class="menu">
+<P><B>Documentation</B><BR class="atl-forced-newline">
+<A href="getting-started.html" title="Getting Started">Getting Started</A><BR class="atl-forced-newline">
+<A href="the-sling-engine.html" title="The Sling Engine">The Sling Engine</A><BR class="atl-forced-newline">
+<A href="development.html" title="Development">Development</A><BR class="atl-forced-newline">
+<A href="bundles.html" title="Bundles">Bundles</A><BR class="atl-forced-newline">
+<A href="tutorials-how-tos.html" title="Tutorials & How-Tos">Tutorials &amp; How&#45;Tos</A><BR class="atl-forced-newline">
+<A href="configuration.html" title="Configuration">Configuration</A><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/apidocs/sling6/index.html" class="external-link" rel="nofollow">API docs</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.wiki" class="external-link" rel="nofollow">Wiki</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.faq" class="external-link" rel="nofollow">FAQ</A><BR class="atl-forced-newline"></P>
+
+<P><B>Project info</B><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/site/downloads.cgi" class="external-link" rel="nofollow">Downloads</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/licenses/" class="external-link" rel="nofollow">License</A><BR class="atl-forced-newline">
+<A href="contributing.html" title="Contributing">Contributing</A><BR class="atl-forced-newline">
+<A href="news.html" title="News">News</A><BR class="atl-forced-newline">
+<A href="links.html" title="Links">Links</A><BR class="atl-forced-newline">
+<A href="project-information.html" title="Project Information">Project Information</A><BR class="atl-forced-newline">
+<A href="https://issues.apache.org/jira/browse/SLING" class="external-link" rel="nofollow">Issue Tracker</A><BR class="atl-forced-newline">
+<A href="http://svn.apache.org/viewvc/sling/trunk" class="external-link" rel="nofollow">Browse Source Repository</A><BR class="atl-forced-newline">
+<A href="security.html" title="Security">Security</A><BR class="atl-forced-newline"></P>
+
+<P><B>Sponsorship</B><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/sponsorship.html" class="external-link" rel="nofollow">Become a Sponsor</A><BR>
+<A href="http://www.apache.org/foundation/buy_stuff.html" class="external-link" rel="nofollow">Buy Stuff</A></P>
+
+
+  <IFRAME src="http://www.apache.org/ads/button.html" style="border-width:0; float: left" frameborder="0" scrolling="no" width="135" height="135"></IFRAME>
+  <P style="height: 135px"></P>
+    </DIV>
+    <DIV class="main">
+        <DIV class="breadcrump" style="font-size: 80%;">
+<A href="apache-sling.html" title="Apache Sling Website">Apache Sling Website</A>&nbsp;&gt;&nbsp;<A href="apache-sling.html" title="Apache Sling">Apache Sling</A>&nbsp;&gt;&nbsp;<A href="documentation.html" title="Documentation">Documentation</A>&nbsp;&gt;&nbsp;<A href="the-sling-engine.html" title="The Sling Engine">The Sling Engine</A>&nbsp;&gt;&nbsp;<A href="authentication.html" title="Authentication">Authentication</A>&nbsp;&gt;&nbsp;<A href="authentication-authenticationhandler.html" title="Authentication - AuthenticationHandler">Authentication - AuthenticationHandler</A>&nbsp;&gt;&nbsp;<A href="" title="Form Based AuthenticationHandler">Form Based AuthenticationHandler</A>
+        </DIV>
+<H1><A name="FormBasedAuthenticationHandler-FormBasedAuthenticationHandler"></A>Form Based AuthenticationHandler</H1>
+
+<DIV><A href="#FormBasedAuthenticationHandler-AuthenticationHandlerimplementation">AuthenticationHandler implementation</A> | <A href="#FormBasedAuthenticationHandler-AuthenticationFeedbackHandlerimplementation">AuthenticationFeedbackHandler implementation</A> | <A href="#FormBasedAuthenticationHandler-Phase1%253AFormSubmission">Phase 1: Form Submission</A> | <A href="#FormBasedAuthenticationHandler-Phase2%253AAuthenticatedRequests">Phase 2: Authenticated Requests</A> | <A href="#FormBasedAuthenticationHandler-Configuration">Configuration</A> | <A href="#FormBasedAuthenticationHandler-SecurityConsiderations">Security Considerations</A></DIV>
+
+<P>The Form Based AuthenticationHandler has two authentication phases: The first phase is presenting a login form to the user and passing the entered user name and password to the server. The second phase is storing successful authentication in a Cookie or an HTTP Session.</P>
+
+<P>The implementation of the Form Based Authentication Handler follows the guidelines of the Servlet API 2.4 specification for <EM>Form Based Authentication</EM> in section SRV.12.5.3. Specifically the following requirements are implemented:</P>
+
+<UL>
+	<LI>For the initial form submission, the request URL must end with <TT>/j_security_check</TT> and the user name and password names must be <TT>j_username</TT> and <TT>j_password</TT>, resp.</LI>
+	<LI>The authentication type as returned by <TT>HttpServletRequest.getAuthType()</TT> is set to <TT>HttpServletRequest.FORM_AUTH</TT>.</LI>
+</UL>
+
+
+<P>The Form Based Authentication Handler is maintained in the <A href="http://svn.apache.org/repos/asf/sling/trunk/bundles/auth/form" class="external-link" rel="nofollow">Sling SVN</A></P>
+
+
+<H3><A name="FormBasedAuthenticationHandler-AuthenticationHandlerimplementation"></A>AuthenticationHandler implementation</H3>
+
+
+<UL>
+	<LI><TT>extractCredentials</TT> &ndash; Prepares credentials for the form entered data or from the Cookie or HTTP Session attribute. Returns <TT>null</TT> if neither data is provided in the request</LI>
+	<LI><TT>requestCredentials</TT> &ndash; Redirects the client (browser) to the login form</LI>
+	<LI><TT>dropCredentials</TT> &ndash; Remove the Cookie or remove the HTTP Session attribute</LI>
+</UL>
+
+
+
+<H3><A name="FormBasedAuthenticationHandler-AuthenticationFeedbackHandlerimplementation"></A>AuthenticationFeedbackHandler implementation</H3>
+
+<UL>
+	<LI><TT>authenticationFailed</TT> &ndash; Remove the Cookie or remove the HTTP Session attribute</LI>
+	<LI><TT>authenticationSucceeded</TT> &ndash; Set (or update) the Cookie or HTTP Session attribute</LI>
+</UL>
+
+
+
+<H3><A name="FormBasedAuthenticationHandler-Phase1%3AFormSubmission"></A>Phase 1: Form Submission</H3>
+
+
+<P>The login form submitted in phase 1 to validate the user name and password must be provided in an HTTP <TT>POST</TT> request to an URL whose last segment is <TT>j_security_check</TT>. The request is ignored as a form submission if either the method is not <TT>POST</TT> or the last segment is no <TT>j_security_check</TT>.</P>
+
+<P>The form is rendered by redirecting the client to the URL indicated by the <TT>form.login.form</TT> configuration parameter. This redirection request may accompanyied by the following parameters:</P>
+
+<UL>
+	<LI><TT>resource</TT> &ndash; The resource to which the user should be redirected after successful login. This request parameter should be submitted back to the server as the <TT>resource</TT> parameter.</LI>
+	<LI><TT>j_reason</TT> &ndash; This parameter indicates the reason for rendering the login form. If this parameter is set, it is set to <TT>INVALID_CREDENTIALS</TT> indicating a previous form submission presented invalid username and password or <TT>TIMEOUT</TT> indicating a login session has timed out. The login form servlet/script can present the user with an appropriate message.</LI>
+</UL>
+
+
+<P>The Form Based Authentication Handlers supports the following request parameters submitted by the HTML form:</P>
+
+<UL>
+	<LI><TT>j_username</TT> &ndash; Name of the user to authenticate</LI>
+	<LI><TT>j_password</TT> &ndash; Password to authenticate the user</LI>
+	<LI><TT>j_validate</TT> &ndash; Flag indicating whether to just validate the credentials</LI>
+	<LI><TT>resource</TT> &ndash; The location to go to on successful login</LI>
+	<LI><TT>sling.auth.redirect</TT> &ndash; The location to redirect to on successful login</LI>
+</UL>
+
+
+<P>The <TT>j_username</TT> and <TT>j_password</TT> parameters are used to create a JCR <TT>SimpleCredentials</TT> object to log into the JCR Repository.</P>
+
+<P>The <TT>j_validate</TT> parameter may be used to implement login form submission using AJAX. If this parameter is set to <TT>true</TT> (case-insensitive) the credentials are used to login and after success or failure to return a status code:</P>
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> Status </TH>
+<TH class="confluenceTh"> Description </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>200 OK</TT> </TD>
+<TD class="confluenceTd"> Authentication succeeded; credentials are valid for login; the Cookie or HTTP Session attribute is now set </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>403 FORBIDDEN</TT> </TD>
+<TD class="confluenceTd"> Authentication failed; credentials are invalid for login; the Cookie or HTTP Session attribute is not set (if it was set, it is now cleared) </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+<P>If the <TT>j_validate</TT> parameter is not set or is set to any value other than <TT>true</TT>, the request processing depends on authentication success or failure:</P>
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> Authentication </TH>
+<TH class="confluenceTh"> Description </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> Success </TD>
+<TD class="confluenceTd"> Client is redirected to the authenticated resource; the Cookie or HTTP Session attribute is now set. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> Failure </TD>
+<TD class="confluenceTd"> The request is redirected to the login form again; the Cookie or HTTP Session attribute is not set (if it was set, it is now cleared) </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+<P>The <TT>resource</TT> and <TT>sling.auth.redirect</TT> parameters provide similar functionality but with differing historical backgrounds. The <TT>resource</TT> parameter is based on the <TT>resource</TT> request attribute which is set by the login servlet to indicate the original target resource the client desired when it was forced to authenticate. The <TT>sling.auth.redirect</TT> parameter can be used by clients (applications like cURL or plain HTML forms) to request being redirected after successful login. If both parameters are set, the <TT>sling.auth.redirect</TT> parameter takes precedence.</P>
+
+<P>The Form Based Authentication Handler contains a <A href="http://http/svn.apache.org/repos/asf/sling/trunk/bundles/auth/form/src/main/java/org/apache/sling/auth/form/impl/AuthenticationFormServlet.java" class="external-link" rel="nofollow">default form servlet</A> and <A href="http://svn.apache.org/repos/asf/sling/trunk/bundles/auth/form/src/main/resources/org/apache/sling/auth/form/impl/login.html" class="external-link" rel="nofollow">HTML form template from</A>.</P>
+
+
+<H3><A name="FormBasedAuthenticationHandler-Phase2%3AAuthenticatedRequests"></A>Phase 2: Authenticated Requests</H3>
+
+
+<P>After the successful authentication of the user in phase 1, the authentication state is stored in a Cookie or an HTTP Session. The stored value is a security token with the following contents:</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+HmacSHA1(securetoken, &lt;securetokennumber&gt;&lt;expirytime&gt;@&lt;userID&gt;)@&lt;securetokennumber&gt;&lt;expirytime&gt;@&lt;userID&gt;
+</PRE>
+</DIV></DIV>
+
+<P>The <TT>securetoken</TT> and <TT>securetokennumber</TT> are related in that an table of secure tokens is maintained where the <TT>securetoken</TT> is an entry in the table and the <TT>securetokennumber</TT> is the index in of the token in the table.</P>
+
+<P>The secure tokens are refreshed periodically causing the authentication state stored in the Cookie or the HTTP Session to be updated peridocally. This periodic update has two advantages:</P>
+
+<UL>
+	<LI>Login sessions time out after some period of inactivity: If a request is handled for an authentication state whose expiry time has passed, the request is considered unauthenticated.</LI>
+	<LI>If a Cookie would be stolen or an HTTP Session be hijacked, the authentication state expires within a reasonable amount of time to try to prevent stealing the authentication.</LI>
+</UL>
+
+
+<P>The authentication state may be transmitted with a Cookie which is configured as follows:</P>
+
+<UL>
+	<LI><B>Cookie Path</B> &ndash; Set to the servlet context path</LI>
+	<LI><B>Domain</B> &ndash; See below</LI>
+	<LI><B>Age</B> &ndash; Set to -1 to indicate a session Cookie</LI>
+	<LI><B>Secure</B> &ndash; Set to the value returned by the <TT>ServletRequest.isSecure()</TT> method</LI>
+</UL>
+
+
+<P>If the authentication state is kept in an HTTP Session the setup of the session ID cookie is maintained by the servlet container and is outside of the control of the Form Based AuthenticationHandler.</P>
+
+
+<H3><A name="FormBasedAuthenticationHandler-Configuration"></A>Configuration</H3>
+
+<P>The Form Based Authentication Handler is configured with configuration provided by the OSGi Configuration Admin Service using the <TT>org.apache.sling.formauth.FormAuthenticationHandler</TT> service PID.</P>
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> Parameter </TH>
+<TH class="confluenceTh"> Default </TH>
+<TH class="confluenceTh"> Description </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>form.login.form</TT> </TD>
+<TD class="confluenceTd"> <TT>/system/sling/form/login</TT> </TD>
+<TD class="confluenceTd"> The URL (without any context path prefix) to redirect the client to to present the login form. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>form.auth.storage</TT> </TD>
+<TD class="confluenceTd"> <TT>cookie</TT> </TD>
+<TD class="confluenceTd"> The type of storage used to provide the authentication state. Valid values are <TT>cookie</TT> and <TT>session</TT>. The default value also applies if any setting other than the supported values is configured. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>form.auth.name</TT> </TD>
+<TD class="confluenceTd"> <TT>sling.formauth</TT> </TD>
+<TD class="confluenceTd"> The name of the Cookie or HTTP Session attribute providing the authentication state. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>form.auth.timeout</TT> </TD>
+<TD class="confluenceTd"> <TT>30</TT> </TD>
+<TD class="confluenceTd">The number of minutes after which a login session times out. This value is used as the expiry time set in the authentication data. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>form.credentials.name</TT> </TD>
+<TD class="confluenceTd"> <TT>sling.formauth</TT> </TD>
+<TD class="confluenceTd"> The name of the <TT>SimpleCredentials</TT> attribute used to provide the authentication data to the <TT>LoginModulePlugin</TT>. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>form.token.file</TT> </TD>
+<TD class="confluenceTd"> <TT>cookie-tokens.bin</TT> </TD>
+<TD class="confluenceTd"> The name of the file used to persist the security tokens. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>form.default.cookie.domain</TT> </TD>
+<TD class="confluenceTd">&nbsp;</TD>
+<TD class="confluenceTd"> The domain on which cookies will be set, unless overridden in the <TT>AuthenticationInfo</TT> object. </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+<P><EM>Note:</EM> The <TT>form.token.file</TT> parameter currently refers to a file stored in the file system. If the path is a relative path, the file is either stored in the Authentication Handler bundle private data area or &ndash; if not possible &ndash; below the location indicated by the <TT>sling.home</TT> framework property or &ndash; if <TT>sling.home</TT> is not set &ndash; the current working directory. In the future this file may be store in the JCR Repository to support clustering scenarios.</P>
+
+
+<H3><A name="FormBasedAuthenticationHandler-SecurityConsiderations"></A>Security Considerations</H3>
+
+<P>Form Based Authentication has some limitations in terms of security:</P>
+
+<OL>
+	<LI>User name and password are transmitted in plain text in the initial form submission.</LI>
+	<LI>The Cookie used to provide the authentication state or the HTTP Session ID may be stolen.</LI>
+</OL>
+
+
+<P>To prevent eavesdroppers from sniffing the credentials or stealing the Cookie a secure transport layer should be used such as TLS/SSL, VPN or IPSec.</P>
+        <DIV class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by fmeschbe on 2011-05-25 10:04:53.0
+        </DIV>
+        <DIV class="trademarkFooter">
+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.
+        </DIV>
+    </DIV>
+  </BODY>
+</HTML>
+

Propchange: sling/site/trunk/content/site/form-based-authenticationhandler.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/site/trunk/content/site/form-based-authenticationhandler.html
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: sling/site/trunk/content/site/form-based-authenticationhandler.html
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/site/trunk/content/site/getting-and-building-sling.data/test.sh
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/getting-and-building-sling.data/test.sh?rev=1420577&view=auto
==============================================================================
--- sling/site/trunk/content/site/getting-and-building-sling.data/test.sh (added)
+++ sling/site/trunk/content/site/getting-and-building-sling.data/test.sh Wed Dec 12 09:13:50 2012
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+#    Licensed to the Apache Software Foundation (ASF) under one
+#    or more contributor license agreements.  See the NOTICE file
+#    distributed with this work for additional information
+#    regarding copyright ownership.  The ASF licenses this file
+#    to you under the Apache License, Version 2.0 (the
+#    "License"); you may not use this file except in compliance
+#    with the License.  You may obtain a copy of the License at
+#    
+#    http://www.apache.org/licenses/LICENSE-2.0
+#    
+#    Unless required by applicable law or agreed to in writing,
+#    software distributed under the License is distributed on an
+#    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#    KIND, either express or implied.  See the License for the
+#    specific language governing permissions and limitations
+#    under the License.
+#
+
+JAVA_HOME=${JAVA_HOME:=/usr/java/jdk1.5.0_11}
+JAVA=${JAVA_HOME}/bin/java
+JAVA_DEBUG="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=30503,server=y,suspend=n"
+SLING_HOME=sling.test
+SLING_LOG_FILE=
+SLING_DEFS="-Dsling.install.20= -Dorg.osgi.service.http.port=8080"
+SLING_JAR="target/org.apache.sling.launcher.app-2.0.0-incubator-SNAPSHOT.jar"
+
+## Append command line arguments (not actually correct, but suffices it)
+SLING_DEFS="${SLING_DEFS} $@"
+
+## Enable this for JAAS LDAP Auth
+# SLING_DEFS="${SLING_DEFS} -Djava.security.auth.login.config=${PWD}/ldap_login.conf"
+
+## Enable this for JVMTI profiling
+# SLING_DEFS="${SLING_DEFS} -agentlib:yjpagent"
+
+export JAVA JAVA_DEBUG SLING_HOME SLING_LOG_FILE SLING_DEFS
+
+${JAVA} ${JAVA_DEBUG} -Dsling.home=${SLING_HOME} -Dorg.apache.sling.osgi.log.file=${SLING_LOG_FILE} ${SLING_DEFS} -jar ${SLING_JAR}

Propchange: sling/site/trunk/content/site/getting-and-building-sling.data/test.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/site/trunk/content/site/getting-and-building-sling.data/test.sh
------------------------------------------------------------------------------
    svn:executable = *

Propchange: sling/site/trunk/content/site/getting-and-building-sling.data/test.sh
------------------------------------------------------------------------------
    svn:keywords = Id

Added: sling/site/trunk/content/site/getting-and-building-sling.html
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/getting-and-building-sling.html?rev=1420577&view=auto
==============================================================================
--- sling/site/trunk/content/site/getting-and-building-sling.html (added)
+++ sling/site/trunk/content/site/getting-and-building-sling.html Wed Dec 12 09:13:50 2012
@@ -0,0 +1,320 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<HTML>
+  <HEAD>
+    <TITLE>Apache Sling - Getting and Building Sling</TITLE>
+    <LINK rel="stylesheet" href="http://sling.apache.org/site/media.data/site.css" type="text/css" media="all">
+    <LINK rel="icon" href="http://sling.apache.org/site/media.data/favicon.ico">
+    <META http-equiv="Content-Type" content="text/html;charset=UTF-8">
+  </HEAD>
+  <BODY>
+    <DIV class="title">
+      <DIV class="logo">
+        <A href="http://sling.apache.org/site/index.html">
+          <IMG border="0" alt="Apache Sling" src="http://sling.apache.org/site/media.data/logo.png">
+        </A>
+      </DIV>
+      <DIV class="header">
+        <A href="http://www.apache.org/">
+          <IMG border="0" alt="Apache" src="http://sling.apache.org/site/media.data/apache.png">
+        </A>
+      </DIV>
+    </DIV>
+    <DIV class="menu">
+<P><B>Documentation</B><BR class="atl-forced-newline">
+<A href="getting-started.html" title="Getting Started">Getting Started</A><BR class="atl-forced-newline">
+<A href="the-sling-engine.html" title="The Sling Engine">The Sling Engine</A><BR class="atl-forced-newline">
+<A href="development.html" title="Development">Development</A><BR class="atl-forced-newline">
+<A href="bundles.html" title="Bundles">Bundles</A><BR class="atl-forced-newline">
+<A href="tutorials-how-tos.html" title="Tutorials & How-Tos">Tutorials &amp; How&#45;Tos</A><BR class="atl-forced-newline">
+<A href="configuration.html" title="Configuration">Configuration</A><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/apidocs/sling6/index.html" class="external-link" rel="nofollow">API docs</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.wiki" class="external-link" rel="nofollow">Wiki</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.faq" class="external-link" rel="nofollow">FAQ</A><BR class="atl-forced-newline"></P>
+
+<P><B>Project info</B><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/site/downloads.cgi" class="external-link" rel="nofollow">Downloads</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/licenses/" class="external-link" rel="nofollow">License</A><BR class="atl-forced-newline">
+<A href="contributing.html" title="Contributing">Contributing</A><BR class="atl-forced-newline">
+<A href="news.html" title="News">News</A><BR class="atl-forced-newline">
+<A href="links.html" title="Links">Links</A><BR class="atl-forced-newline">
+<A href="project-information.html" title="Project Information">Project Information</A><BR class="atl-forced-newline">
+<A href="https://issues.apache.org/jira/browse/SLING" class="external-link" rel="nofollow">Issue Tracker</A><BR class="atl-forced-newline">
+<A href="http://svn.apache.org/viewvc/sling/trunk" class="external-link" rel="nofollow">Browse Source Repository</A><BR class="atl-forced-newline">
+<A href="security.html" title="Security">Security</A><BR class="atl-forced-newline"></P>
+
+<P><B>Sponsorship</B><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/sponsorship.html" class="external-link" rel="nofollow">Become a Sponsor</A><BR>
+<A href="http://www.apache.org/foundation/buy_stuff.html" class="external-link" rel="nofollow">Buy Stuff</A></P>
+
+
+  <IFRAME src="http://www.apache.org/ads/button.html" style="border-width:0; float: left" frameborder="0" scrolling="no" width="135" height="135"></IFRAME>
+  <P style="height: 135px"></P>
+    </DIV>
+    <DIV class="main">
+        <DIV class="breadcrump" style="font-size: 80%;">
+<A href="apache-sling.html" title="Apache Sling Website">Apache Sling Website</A>&nbsp;&gt;&nbsp;<A href="apache-sling.html" title="Apache Sling">Apache Sling</A>&nbsp;&gt;&nbsp;<A href="documentation.html" title="Documentation">Documentation</A>&nbsp;&gt;&nbsp;<A href="development.html" title="Development">Development</A>&nbsp;&gt;&nbsp;<A href="" title="Getting and Building Sling">Getting and Building Sling</A>
+        </DIV>
+<H1><A name="GettingandBuildingSling-GettingandBuildingSling"></A>Getting and Building Sling</H1>
+<P>A quick guide for getting the Sling source, then building and running the resulting Sling instance; either without or with Eclipse.</P>
+
+<P>Sling can easily be built:</P>
+<UL>
+	<LI>from the command line (using SVN and the Maven command line tool)</LI>
+	<LI>or using Eclipse</LI>
+</UL>
+
+
+<P>Note that you don't <EM>have</EM> to build Sling yourself, if you don't need the bleeding-edge stuff you can get prebuilt binaries from the <A href="http://sling.apache.org/site/downloads.cgi" class="external-link" rel="nofollow">Downloads</A> page.</P>
+
+<P>A full build of Sling takes 5-10 minutes on a recent computer once your local Maven repository is up to date. The first build may take much longer than that if you start with an empty local Maven repository, as Maven will then download its plugins and all the required dependencies.</P>
+
+<H2><A name="GettingandBuildingSling-Prerequisites"></A>Prerequisites</H2>
+
+<P>Before you begin, you need to have the following tools installed on your system:</P>
+<UL>
+	<LI>Java 5 or higher; Java 6 recommended</LI>
+	<LI><A href="http://maven.apache.org/" class="external-link" rel="nofollow">Maven</A> 3.0.2 or later; enforced by the Sling parent pom</LI>
+</UL>
+
+
+<P>If you want to set up Eclipse (not required to build Sling) you'll also need the following installed:</P>
+<UL>
+	<LI>Eclipse (tested with 3.4.2 and 3.5.x on Win XP, SP3, 3.6.x on Win7, 3.7 on MacOS X 10.6); just a plain installation of the platform runtime binary and the JDT will be adequate (you can install the IDE for Java Developers for convenience)</LI>
+	<LI>M2Eclipse plugin for Eclipse (sonatype) &#45;&gt; <A href="http://m2eclipse.sonatype.org/installing-m2eclipse.html" class="external-link" rel="nofollow">instructions</A></LI>
+	<LI><A href="http://www.polarion.com/products/svn/subversive.php" class="external-link" rel="nofollow">Subversive plugin</A> or <A href="http://subclipse.tigris.org/" class="external-link" rel="nofollow">Subclipse-plugin</A> for Eclipse</LI>
+</UL>
+
+
+<H2><A name="GettingandBuildingSling-EnvironmentSetup"></A>Environment Setup</H2>
+
+<P>The full build process requires quite a lot of resources, so you may run into limits. The following hints should show you what to setup before building Sling.</P>
+
+
+<H3><A name="GettingandBuildingSling-JavaHeapSpace"></A>Java Heap Space</H3>
+
+<UL>
+	<LI><B>Problem</B> &#45; Build aborts with reports of <TT>java.lang.OutOfMemoryError: Java heap space</TT>. Alternatively the build may randomly fail during the integration tests.</LI>
+	<LI><B>Platforms</B> &#45; This happens on all platforms</LI>
+	<LI><B>Fix</B> &#45; Increase the values of the maximum heap and perm space for the build by setting or extending the <TT>MAVEN_OPTS</TT> environment variable.</LI>
+</UL>
+
+
+<P>For 32bit platforms you should use</P>
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
+<PRE>MAVEN_OPTS=&quot;-Xmx256M -XX:MaxPermSize=256m&quot;
+</PRE>
+</DIV></DIV>
+
+<P>For 64bit platforms, you should use</P>
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
+<PRE>MAVEN_OPTS=&quot;-Xmx512M -XX:MaxPermSize=512m&quot;
+</PRE>
+</DIV></DIV>
+
+<P>For more information see <A href="https://issues.apache.org/jira/browse/SLING-443" class="external-link" rel="nofollow">SLING-443</A> and <A href="https://issues.apache.org/jira/browse/SLING-1782" class="external-link" rel="nofollow">SLING-1782</A>.</P>
+
+
+<H3><A name="GettingandBuildingSling-EnvironmentVariableSpace"></A>Environment Variable Space</H3>
+
+<UL>
+	<LI><B>Problem</B> &#45; Build aborts when trying to launch the integration tests with the message
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
+<PRE>[INFO] Error while executing forked tests.; nested exception is org.apache.maven.surefire.booter.shade.org.codehaus.plexus.util.cli.CommandLineException: Error setting up environmental variables
+
+error=12, Not enough space
+</PRE>
+</DIV></DIV>
+<P>This problem is caused by insufficient swap space. When running the integration tests in the <TT>launchpad/testing</TT> modules, a process is launched by calling the <TT>exec</TT> system call. This copies the process (copy-on-write, though) and thus allocates as much virtual memory as is owned by the parent process. This may fail if swap space is exhausted.</P></LI>
+	<LI><B>Platform</B> &#45; OpenSolaris</LI>
+	<LI><B>Fix</B> &#45; If this issue persists you will need to check your system requirements and configuration with regard to swap, before taking action - if necessary.</LI>
+</UL>
+
+
+<H2><A name="GettingandBuildingSling-ConfiguringMaven"></A>Configuring Maven</H2>
+
+<P>See <A href="maventipsandtricks.html" title="MavenTipsAndTricks">MavenTipsAndTricks</A>.</P>
+
+
+<H2><A name="GettingandBuildingSling-GettingtheSlingSource"></A>Getting the Sling Source</H2>
+
+
+<H3><A name="GettingandBuildingSling-WithSVN"></A>With SVN</H3>
+
+<OL>
+	<LI>Checkout Sling from the Repository.
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
+<PRE>$ svn checkout http://svn.apache.org/repos/asf/sling/trunk sling
+</PRE>
+</DIV></DIV></LI>
+</OL>
+
+
+<H3><A name="GettingandBuildingSling-WithEclipseSubversiveorSubclipse"></A>With Eclipse Subversive or Subclipse</H3>
+<P>First note how simple the above SVN instructions are...but if you <EM>really</EM> want to do this, read on.</P>
+
+<P>If you use the Subversive plugin make sure you have installed the &quot;Subversive Integration for M2Eclipse Project&quot; which can be found under the following Eclipse update site: <A href="http://community.polarion.com/projects/subversive/download/integrations/update-site/" class="external-link" rel="nofollow">http://community.polarion.com/projects/subversive/download/integrations/update-site/</A>.</P>
+
+<P>Also, make sure that you have installed either the &quot;Maven SCM handler for Subclipse&quot; or the &quot;Maven SCM handler for Subversive&quot;.</P>
+
+<H4><A name="GettingandBuildingSling-Createanewworkspace"></A>Create a new workspace</H4>
+
+<P>It's best to create a new workspace for the sling project:</P>
+<OL>
+	<LI>Menu: File-&gt;Switch Workspace-&gt;Other...</LI>
+	<LI>Enter a path for the new workspace and click OK</LI>
+	<LI>When Eclipse has restarted it's time to adjust some configs</LI>
+	<LI>Turn off automatic build (Menu: Project-&gt;Build Automatically)</LI>
+	<LI>Go to menu: Eclipse-&gt;Preferences, in the preferences dialog select Java &#45;&gt; Compiler &#45;&gt; Errors/Warnings</LI>
+	<LI>Expand the &quot;Deprecated and restricted API&quot; and change &quot;Forbidden references (access rules)&quot; from &quot;Error&quot; to &quot;Warning&quot;</LI>
+	<LI>Click OK</LI>
+</OL>
+
+
+<H4><A name="GettingandBuildingSling-CheckouttheSlingsource"></A>Checkout the Sling source</H4>
+
+<OL>
+	<LI>Menu: File-&gt;Import</LI>
+	<LI>In the Import wizard select Maven-&gt;&quot;Check out Maven Projects from SCM&quot;</LI>
+	<LI>Click next</LI>
+	<LI>In the &quot;SCM URL&quot; field pick &quot;SVN&quot; and enter the url &quot;http://svn.apache.org/repos/asf/sling/trunk&quot;</LI>
+	<LI>Click Finish</LI>
+</OL>
+
+
+<P>Eclipse will now start to download the source and import the Maven projects. You might encounter some &quot;Problem Occured&quot; dialogs about &quot;An internal error...&quot;, but just click OK on those and let Eclipse continue with the import. Be warned: This could take some time (it was 30 minutes on my laptop)&#33;</P>
+
+<P>Possibly something in sling-builder might get a bit messed up (I didn't experience that problem, but Pontus reported it) then you can simply fix it with revert:</P>
+<OL>
+	<LI>In the Project Explorer right-click on the &quot;sling-builder&quot; project and select the Team-&gt;Revert... menu</LI>
+	<LI>A couple of changes will be displayed</LI>
+	<LI>Click OK</LI>
+</OL>
+
+
+<H2><A name="GettingandBuildingSling-BuildingSling"></A>Building Sling</H2>
+
+
+<H3><A name="GettingandBuildingSling-WiththeMavencommandlinetool"></A>With the Maven command line tool</H3>
+
+<OL>
+	<LI>Enter the directory, then do a full build and local install (below are unix/linux commands, slightly different under windows)
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
+<PRE>$ cd sling
+$ export MAVEN_OPTS=&quot;-Xmx256m -XX:MaxPermSize=128m&quot;
+$ mvn -s /dev/null clean install
+</PRE>
+</DIV></DIV>
+<P>Note: On windows just leave out <TT>/dev/null</TT> and make sure you have an empty settings.xml file for maven (located in your user directory under .m2).</P></LI>
+	<LI>Enter the <TT>launchpad/builder</TT> directory and launch Sling for the first time
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
+<PRE>$ cd launchpad/builder
+$ java -jar target/org.apache.sling.launchpad-*-standalone.jar -c test -f -
+</PRE>
+</DIV></DIV></LI>
+</OL>
+
+
+<DIV class="panelMacro"><TABLE class="noteMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>When starting Sling inside the <TT>launchpad/builder</TT> folder you should not use the default Sling Home folder name <TT>sling</TT> because this folder is removed when running <TT>mvn clean</TT>.</TD></TR></TABLE></DIV>
+
+<P>Messages should now be printed to the console which is being used as the &quot;log file&quot;; the <TT>&#45;f</TT> command line option is set to <TT>&#45;</TT>, indicating the use of standard output as the log file. The <TT>&#45;c sling</TT> command line option instructs Sling to use the <TT>sling</TT> directory in the current directory for its data store, which is the Apache Felix bundle archive, the Jackrabbit repository data and configuration. You may also specify another directory here, either a relative or absolute path name (See also <A href="configuration.html" title="Configuration">Configuration</A> for more information). <BR>
+Use the <TT>-h</TT> option to see the list of flags and options.<BR>
+After all messages have been printed you should be able to open the Sling Management Console by pointing your web browser at <TT><A href="http://localhost:8080/system/console" class="external-link" rel="nofollow">http://localhost:8080/system/console</A></TT>. You will be prompted for a user name and password. Enter <TT>admin</TT> for both the user name and the password (this may be set on the <EM>Configuration</EM> page later). From this console, you can manage the installed bundles, modify configuration objects, dump a configuration status and see some system information.<BR>
+To stop Sling, just hit <TT>Ctrl-C</TT> in the console or click the <EM>Stop</EM> button on the <EM>System Information</EM> page of the Sling Management Console.</P>
+
+<H3><A name="GettingandBuildingSling-WithM2Eclipse"></A>With M2Eclipse</H3>
+
+<OL>
+	<LI>Make sure you're in the Java perspective (Menu: Window-&gt;Open Perspective)</LI>
+	<LI>Menu: Run-&gt;Run Configurations...</LI>
+	<LI>In the Run Configurationa dialog right-click on &quot;Maven Build&quot; and select &quot;New&quot;</LI>
+	<LI>Change Name to &quot;Build Sling&quot;</LI>
+	<LI>Click &quot;Browse Workspace...&quot; and select &quot;sling-builder&quot;</LI>
+	<LI>Enter &quot;clean install&quot; in Goals</LI>
+	<LI>Click on the JRE tab</LI>
+	<LI>Enter &quot;-Xmx256m &#45;XX:MaxPermSize=128m&quot; in &quot;VM arguments&quot;</LI>
+	<LI>Click Apply</LI>
+	<LI>Click Run</LI>
+</OL>
+
+
+<H3><A name="GettingandBuildingSling-AlternativesetupinEclipsewithoutM2Eclipseplugin"></A>Alternative setup in Eclipse without M2Eclipse plugin</H3>
+
+<P>In the case that you do not want to use the M2Eclipse plugin there's another setup that lets you have the automatic build turned on:</P>
+<OL>
+	<LI>Checkout the whole sling trunk (with subversive or the subclipse plugin) from SVN to a single project</LI>
+	<LI>Then manually add all <TT>src/main/java</TT> and <TT>src/test/java</TT> of the bundles to the project as source folders</LI>
+	<LI>Add all required libraries to the build path</LI>
+	<LI>Now you can build either in Eclipse or even better use &quot;mvn clean install&quot; on the command line</LI>
+</OL>
+
+
+<P>If you use &quot;mvn clean install&quot; to build Sling be sure you have set MAVEN_OPTS to &quot;-Xmx384m &#45;XX:PermSize=256m&quot; otherwise you will probably get OutOfmemory errors.</P>
+
+<P>Congratulations &#33; You should now have a running Sling instance, that you can start playing around with.</P>
+
+<H2><A name="GettingandBuildingSling-FurtherTipsandTricks"></A>Further Tips and Tricks</H2>
+
+
+<H3><A name="GettingandBuildingSling-DebugSlinginEclipse"></A>Debug Sling in Eclipse</H3>
+
+<P>You can use remote debugging to debug Sling in Eclipse, here's a little How-To</P>
+<OL>
+	<LI>start Sling from the command line with
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
+<PRE>java -Xmx384M -agentlib:jdwp=transport=dt_socket,address=30303,server=y,suspend=n -jar org.apache.sling.launchpad.app-6-SNAPSHOT.jar
+</PRE>
+</DIV></DIV></LI>
+	<LI>Open Menu Run-&gt; Debug configurations</LI>
+	<LI>Right-click on &quot;Remote Java Applications&quot;</LI>
+	<LI>Choose &quot;New&quot;</LI>
+	<LI>In the &quot;Connect&quot; tab choose the Eclipse Sling Project for the field &quot;Project&quot; with the browse button</LI>
+	<LI>Let the Connection type be &quot;Standard (Socket Attach)&quot;</LI>
+	<LI>The host should be localhost</LI>
+	<LI>Set the Port to 30303</LI>
+	<LI>On the source tab click the &quot;Add&quot; button</LI>
+	<LI>Select &quot;Java Project&quot;</LI>
+	<LI>Select all Sling projects and click OK</LI>
+	<LI>Click &quot;Debug&quot;</LI>
+</OL>
+
+
+<P>Now you should be able to set breakpoints, evaluate properties, and so on as usual.</P>
+
+<H3><A name="GettingandBuildingSling-DebugMavenTestsinEclipse"></A>Debug Maven Tests in Eclipse</H3>
+
+<P>In the same way as you can debug the sling app, you are also able to debug a maven test. Just run the maven tests like this</P>
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
+<PRE>mvn -Dmaven.surefire.debug test
+</PRE>
+</DIV></DIV>
+
+<P>The tests will automatically pause and await a remote debugger on port 5005. You can then attach to the running tests using Eclipse. You can setup a &quot;Remote Java Application&quot; launch configuration via the menu command &quot;Run&quot; &gt; &quot;Open Debug Dialog...&quot; (see above).<BR>
+For more information on this see the <A href="http://maven.apache.org/plugins/maven-surefire-plugin/examples/debugging.html" class="external-link" rel="nofollow">Maven Surefire Docu</A>.</P>
+
+
+<H3><A name="GettingandBuildingSling-SimplewaytodevelopnewbundleinEclipseforSling"></A>Simple way to develop new bundle in Eclipse for Sling</H3>
+
+<P>The easiest way that I found is to create a new folder in the existing Eclipse workspace. After that you can follow these steps:</P>
+<UL>
+	<LI>Start by copying and adapting an existing Sling pom.xml (eg. the pom.xml from the espblog sample)</LI>
+	<LI>Generate the Eclipse project files using mvn eclipse:eclipse</LI>
+	<LI>Choose File/Import in Eclipse and select &quot;Existing projects into workspace&quot;</LI>
+	<LI>Now you can create, edit and compile the files in Eclipse</LI>
+	<LI>To create the bundle jar and install it, just use the command line &quot;mvn clean install&quot; in the project directory</LI>
+	<LI>If you have a running Sling app you can install the bundle from the command line with &quot;mvn &#45;P autoInstallBundle clean install &#45;Dsling.url=<A href="http://localhost:8080/system/console" class="external-link" rel="nofollow">http://localhost:8080/system/console</A>&quot;</LI>
+</UL>
+
+
+<P>If adding dependencies to the poms, run mvn eclipse:eclipse again and refresh the project in Eclipse. Debugging works as described above.</P>
+        <DIV class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by cziegeler@apache.org on Thu Nov 15 08:40:16 EST 2012
+        </DIV>
+        <DIV class="trademarkFooter">
+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.
+        </DIV>
+    </DIV>
+  </BODY>
+</HTML>
+

Propchange: sling/site/trunk/content/site/getting-and-building-sling.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/site/trunk/content/site/getting-and-building-sling.html
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: sling/site/trunk/content/site/getting-and-building-sling.html
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/site/trunk/content/site/getting-resources-and-properties-in-sling.html
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/getting-resources-and-properties-in-sling.html?rev=1420577&view=auto
==============================================================================
--- sling/site/trunk/content/site/getting-resources-and-properties-in-sling.html (added)
+++ sling/site/trunk/content/site/getting-resources-and-properties-in-sling.html Wed Dec 12 09:13:50 2012
@@ -0,0 +1,178 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<HTML>
+  <HEAD>
+    <TITLE>Apache Sling - Getting Resources and Properties in Sling</TITLE>
+    <LINK rel="stylesheet" href="http://sling.apache.org/site/media.data/site.css" type="text/css" media="all">
+    <LINK rel="icon" href="http://sling.apache.org/site/media.data/favicon.ico">
+    <META http-equiv="Content-Type" content="text/html;charset=UTF-8">
+  </HEAD>
+  <BODY>
+    <DIV class="title">
+      <DIV class="logo">
+        <A href="http://sling.apache.org/site/index.html">
+          <IMG border="0" alt="Apache Sling" src="http://sling.apache.org/site/media.data/logo.png">
+        </A>
+      </DIV>
+      <DIV class="header">
+        <A href="http://www.apache.org/">
+          <IMG border="0" alt="Apache" src="http://sling.apache.org/site/media.data/apache.png">
+        </A>
+      </DIV>
+    </DIV>
+    <DIV class="menu">
+<P><B>Documentation</B><BR class="atl-forced-newline">
+<A href="getting-started.html" title="Getting Started">Getting Started</A><BR class="atl-forced-newline">
+<A href="the-sling-engine.html" title="The Sling Engine">The Sling Engine</A><BR class="atl-forced-newline">
+<A href="development.html" title="Development">Development</A><BR class="atl-forced-newline">
+<A href="bundles.html" title="Bundles">Bundles</A><BR class="atl-forced-newline">
+<A href="tutorials-how-tos.html" title="Tutorials & How-Tos">Tutorials &amp; How&#45;Tos</A><BR class="atl-forced-newline">
+<A href="configuration.html" title="Configuration">Configuration</A><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/apidocs/sling6/index.html" class="external-link" rel="nofollow">API docs</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.wiki" class="external-link" rel="nofollow">Wiki</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.faq" class="external-link" rel="nofollow">FAQ</A><BR class="atl-forced-newline"></P>
+
+<P><B>Project info</B><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/site/downloads.cgi" class="external-link" rel="nofollow">Downloads</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/licenses/" class="external-link" rel="nofollow">License</A><BR class="atl-forced-newline">
+<A href="contributing.html" title="Contributing">Contributing</A><BR class="atl-forced-newline">
+<A href="news.html" title="News">News</A><BR class="atl-forced-newline">
+<A href="links.html" title="Links">Links</A><BR class="atl-forced-newline">
+<A href="project-information.html" title="Project Information">Project Information</A><BR class="atl-forced-newline">
+<A href="https://issues.apache.org/jira/browse/SLING" class="external-link" rel="nofollow">Issue Tracker</A><BR class="atl-forced-newline">
+<A href="http://svn.apache.org/viewvc/sling/trunk" class="external-link" rel="nofollow">Browse Source Repository</A><BR class="atl-forced-newline">
+<A href="security.html" title="Security">Security</A><BR class="atl-forced-newline"></P>
+
+<P><B>Sponsorship</B><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/sponsorship.html" class="external-link" rel="nofollow">Become a Sponsor</A><BR>
+<A href="http://www.apache.org/foundation/buy_stuff.html" class="external-link" rel="nofollow">Buy Stuff</A></P>
+
+
+  <IFRAME src="http://www.apache.org/ads/button.html" style="border-width:0; float: left" frameborder="0" scrolling="no" width="135" height="135"></IFRAME>
+  <P style="height: 135px"></P>
+    </DIV>
+    <DIV class="main">
+        <DIV class="breadcrump" style="font-size: 80%;">
+<A href="apache-sling.html" title="Apache Sling Website">Apache Sling Website</A>&nbsp;&gt;&nbsp;<A href="apache-sling.html" title="Apache Sling">Apache Sling</A>&nbsp;&gt;&nbsp;<A href="documentation.html" title="Documentation">Documentation</A>&nbsp;&gt;&nbsp;<A href="tutorials-how-tos.html" title="Tutorials & How-Tos">Tutorials &amp; How-Tos</A>&nbsp;&gt;&nbsp;<A href="" title="Getting Resources and Properties in Sling">Getting Resources and Properties in Sling</A>
+        </DIV>
+<H1><A name="GettingResourcesandPropertiesinSling-GettingResourcesandPropertiesinSling"></A>Getting Resources and Properties in Sling</H1>
+
+<P>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.</P>
+
+<P>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.</P>
+
+<P>The whole game consists in first getting a <TT>ResourceResolver</TT> and then getting the <TT>Resource</TT> itself.</P>
+
+<H2><A name="GettingResourcesandPropertiesinSling-WithinanOSGIService%2FCompoment"></A>Within an OSGI Service/Compoment </H2>
+
+<P>You can access a resource through the <TT>ResourceResolverFactory</TT> service:</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+/** @scr.reference */
+<SPAN class="code-keyword">private</SPAN> ResourceResolverFactory resolverFactory;
+
+<SPAN class="code-keyword">public</SPAN> void myMethod() {
+    <SPAN class="code-keyword">try</SPAN> {
+	<SPAN class="code-object">String</SPAN> resourcePath = <SPAN class="code-quote">&quot;path/to/resource&quot;</SPAN>;
+    	ResourceResolver resourceResolver = resolverFactory.getAdministrativeResourceResolver(<SPAN class="code-keyword">null</SPAN>);
+	Resource res = resourceResolver.getResource(resourcePath);
+	<SPAN class="code-comment">// <SPAN class="code-keyword">do</SPAN> something with the resource
+</SPAN>	<SPAN class="code-comment">// when done, close the ResourceResolver
+</SPAN>	resourceResolver.close();
+    } <SPAN class="code-keyword">catch</SPAN> (LoginException e) {
+    	<SPAN class="code-comment">// log the error
+</SPAN>    }
+}
+</PRE>
+</DIV></DIV>
+
+
+<H2><A name="GettingResourcesandPropertiesinSling-WithinaServlet"></A>Within a Servlet </H2>
+
+<P>You can access the resource defined by the request URL through the <TT>SlingHttpServletRequest</TT>:</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+Resource res = req.getResource();
+<SPAN class="code-comment">// req is the SlingHttpServletRequest</SPAN>
+</PRE>
+</DIV></DIV>
+
+<P>You can access any resource by first accessing the <TT>ResourceResolver</TT>:</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+<SPAN class="code-object">String</SPAN> resourcePath = <SPAN class="code-quote">&quot;path/to/resource&quot;</SPAN>;
+ResourceResolver resourceResolver = req.getResourceResolver();
+<SPAN class="code-comment">// req is the SlingHttpServletRequest
+</SPAN>Resource res = resourceResolver.getResource(resourcePath);
+</PRE>
+</DIV></DIV>
+
+<H2><A name="GettingResourcesandPropertiesinSling-WithinaJSPfile"></A>Within a JSP file </H2>
+
+<P>When you use the <TT>&lt;sling:defineObjects&gt;</TT> tag in a JSP file, you have access to a few handy objects, one of them is <TT>resource</TT>, the resource that is resolved from the URL. Another one is <TT>resourceResolver</TT>, the <TT>ResourceResolver</TT> defined through the <TT>SlingHttpServletRequest</TT>. </P>
+
+<P>To access a resource:</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+&lt;sling:defineObjects&gt;
+&lt;%
+<SPAN class="code-object">String</SPAN> resourcePath = <SPAN class="code-quote">&quot;path/to/resource&quot;</SPAN>;
+Resource res = resourceResolver.getResource(resourcePath);
+%&gt;
+</PRE>
+</DIV></DIV>
+
+<P>If needed you can adapt a Sling Resource to a JCR Node:</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+Node node = resource.adaptTo(Node.class);
+</PRE>
+</DIV></DIV>
+
+<P>Note: <TT>resource.adaptTo(Node.class)</TT> may return null if the resource is not backed by a JCR node. This is particularly the case for <TT>NonExistingResource</TT> resources or resource provided by a non-JCR resource provider.</P>
+
+<H2><A name="GettingResourcesandPropertiesinSling-AccessingaProperty"></A>Accessing a Property </H2>
+
+<P>The <TT>ValueMap</TT> is an easy way to access properties of a resource. With most resources you can use <TT>Adaptable.adaptTo(Class)</TT> to adapt the resource to a value map:</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+ValueMap properties = res.adaptTo(ValueMap.class);
+<SPAN class="code-comment">// res is the Resource</SPAN>
+</PRE>
+</DIV></DIV>
+
+<P>You can also access the properties through the <TT>ResourceUtil</TT> utility class:</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+ValueMap properties = ResourceUtil.getValueMap(res);
+<SPAN class="code-comment">// res is the Resource</SPAN>
+</PRE>
+</DIV></DIV>
+
+<P>Then, to access a specific String property called <TT>propName</TT>:</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+<SPAN class="code-object">String</SPAN> rule = properties.get(propName, (<SPAN class="code-object">String</SPAN>) <SPAN class="code-keyword">null</SPAN>);
+</PRE>
+</DIV></DIV>
+
+<P>For more details about resources and how to access them in Sling, you can refer to the <A href="http://sling.apache.org/site/resources.html" class="external-link" rel="nofollow">Sling documentation about Resources</A>.</P>
+        <DIV class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by jck on 2010-12-15 04:25:52.0
+        </DIV>
+        <DIV class="trademarkFooter">
+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.
+        </DIV>
+    </DIV>
+  </BODY>
+</HTML>
+

Propchange: sling/site/trunk/content/site/getting-resources-and-properties-in-sling.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/site/trunk/content/site/getting-resources-and-properties-in-sling.html
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: sling/site/trunk/content/site/getting-resources-and-properties-in-sling.html
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/site/trunk/content/site/getting-started.html
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/getting-started.html?rev=1420577&view=auto
==============================================================================
--- sling/site/trunk/content/site/getting-started.html (added)
+++ sling/site/trunk/content/site/getting-started.html Wed Dec 12 09:13:50 2012
@@ -0,0 +1,91 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<HTML>
+  <HEAD>
+    <TITLE>Apache Sling - Getting Started</TITLE>
+    <LINK rel="stylesheet" href="http://sling.apache.org/site/media.data/site.css" type="text/css" media="all">
+    <LINK rel="icon" href="http://sling.apache.org/site/media.data/favicon.ico">
+    <META http-equiv="Content-Type" content="text/html;charset=UTF-8">
+  </HEAD>
+  <BODY>
+    <DIV class="title">
+      <DIV class="logo">
+        <A href="http://sling.apache.org/site/index.html">
+          <IMG border="0" alt="Apache Sling" src="http://sling.apache.org/site/media.data/logo.png">
+        </A>
+      </DIV>
+      <DIV class="header">
+        <A href="http://www.apache.org/">
+          <IMG border="0" alt="Apache" src="http://sling.apache.org/site/media.data/apache.png">
+        </A>
+      </DIV>
+    </DIV>
+    <DIV class="menu">
+<P><B>Documentation</B><BR class="atl-forced-newline">
+<A href="" title="Getting Started">Getting Started</A><BR class="atl-forced-newline">
+<A href="the-sling-engine.html" title="The Sling Engine">The Sling Engine</A><BR class="atl-forced-newline">
+<A href="development.html" title="Development">Development</A><BR class="atl-forced-newline">
+<A href="bundles.html" title="Bundles">Bundles</A><BR class="atl-forced-newline">
+<A href="tutorials-how-tos.html" title="Tutorials & How-Tos">Tutorials &amp; How&#45;Tos</A><BR class="atl-forced-newline">
+<A href="configuration.html" title="Configuration">Configuration</A><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/apidocs/sling6/index.html" class="external-link" rel="nofollow">API docs</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.wiki" class="external-link" rel="nofollow">Wiki</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.faq" class="external-link" rel="nofollow">FAQ</A><BR class="atl-forced-newline"></P>
+
+<P><B>Project info</B><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/site/downloads.cgi" class="external-link" rel="nofollow">Downloads</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/licenses/" class="external-link" rel="nofollow">License</A><BR class="atl-forced-newline">
+<A href="contributing.html" title="Contributing">Contributing</A><BR class="atl-forced-newline">
+<A href="news.html" title="News">News</A><BR class="atl-forced-newline">
+<A href="links.html" title="Links">Links</A><BR class="atl-forced-newline">
+<A href="project-information.html" title="Project Information">Project Information</A><BR class="atl-forced-newline">
+<A href="https://issues.apache.org/jira/browse/SLING" class="external-link" rel="nofollow">Issue Tracker</A><BR class="atl-forced-newline">
+<A href="http://svn.apache.org/viewvc/sling/trunk" class="external-link" rel="nofollow">Browse Source Repository</A><BR class="atl-forced-newline">
+<A href="security.html" title="Security">Security</A><BR class="atl-forced-newline"></P>
+
+<P><B>Sponsorship</B><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/sponsorship.html" class="external-link" rel="nofollow">Become a Sponsor</A><BR>
+<A href="http://www.apache.org/foundation/buy_stuff.html" class="external-link" rel="nofollow">Buy Stuff</A></P>
+
+
+  <IFRAME src="http://www.apache.org/ads/button.html" style="border-width:0; float: left" frameborder="0" scrolling="no" width="135" height="135"></IFRAME>
+  <P style="height: 135px"></P>
+    </DIV>
+    <DIV class="main">
+        <DIV class="breadcrump" style="font-size: 80%;">
+<A href="apache-sling.html" title="Apache Sling Website">Apache Sling Website</A>&nbsp;&gt;&nbsp;<A href="apache-sling.html" title="Apache Sling">Apache Sling</A>&nbsp;&gt;&nbsp;<A href="documentation.html" title="Documentation">Documentation</A>&nbsp;&gt;&nbsp;<A href="" title="Getting Started">Getting Started</A>
+        </DIV>
+<H1><A name="GettingStarted-GettingStarted"></A>Getting Started</H1>
+
+<P>We're on the way to update the documentation to make it more easy to get in touch with Sling. At the moment we can give you the following starting points:</P>
+
+<UL><LI><A href="discover-sling-in-15-minutes.html" title="Discover Sling in 15 minutes">Discover Sling in 15 minutes</A></LI></UL>
+
+<H2><A name="GettingStarted-Wheretoheadfromhere"></A>Where to head from here</H2>
+
+<P>We recommend you read through following topics to get as fast as possible into Sling: </P>
+
+
+<UL>
+	<LI><A href="getting-and-building-sling.html" title="Getting and Building Sling">Getting and Building Sling</A></LI>
+	<LI><A href="architecture.html" title="Architecture">Architecture</A></LI>
+	<LI><A href="dispatching-requests.html" title="Dispatching Requests">Dispatching Requests</A></LI>
+	<LI><A href="resources.html" title="Resources">Resources</A></LI>
+	<LI><A href="http://cwiki.apache.org/SLING/setting-up-eclipse-34-for-sling.html" class="external-link" rel="nofollow">Setting up an Sling-Project with Eclipse</A></LI>
+	<LI><A href="manipulating-content-the-slingpostservlet-servletspost.html" title="Manipulating Content - The SlingPostServlet (servlets.post)">Manipulating Content &#45; The SlingPostServlet &#40;servlets.post&#41;</A></LI>
+	<LI><A href="request-parameters.html" title="Request Parameters">Request Parameters</A></LI>
+	<LI><A href="authentication.html" title="Authentication">Authentication</A></LI>
+	<LI><A href="eventing-and-jobs.html" title="Eventing and Jobs">Eventing and Jobs</A></LI>
+</UL>
+
+        <DIV class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by mykee on 2009-09-01 13:51:58.0
+        </DIV>
+        <DIV class="trademarkFooter">
+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.
+        </DIV>
+    </DIV>
+  </BODY>
+</HTML>
+

Propchange: sling/site/trunk/content/site/getting-started.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/site/trunk/content/site/getting-started.html
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: sling/site/trunk/content/site/getting-started.html
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/site/trunk/content/site/groovy-support.html
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/groovy-support.html?rev=1420577&view=auto
==============================================================================
--- sling/site/trunk/content/site/groovy-support.html (added)
+++ sling/site/trunk/content/site/groovy-support.html Wed Dec 12 09:13:50 2012
@@ -0,0 +1,142 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<HTML>
+  <HEAD>
+    <TITLE>Apache Sling - Groovy Support</TITLE>
+    <LINK rel="stylesheet" href="http://sling.apache.org/site/media.data/site.css" type="text/css" media="all">
+    <LINK rel="icon" href="http://sling.apache.org/site/media.data/favicon.ico">
+    <META http-equiv="Content-Type" content="text/html;charset=UTF-8">
+  </HEAD>
+  <BODY>
+    <DIV class="title">
+      <DIV class="logo">
+        <A href="http://sling.apache.org/site/index.html">
+          <IMG border="0" alt="Apache Sling" src="http://sling.apache.org/site/media.data/logo.png">
+        </A>
+      </DIV>
+      <DIV class="header">
+        <A href="http://www.apache.org/">
+          <IMG border="0" alt="Apache" src="http://sling.apache.org/site/media.data/apache.png">
+        </A>
+      </DIV>
+    </DIV>
+    <DIV class="menu">
+<P><B>Documentation</B><BR class="atl-forced-newline">
+<A href="getting-started.html" title="Getting Started">Getting Started</A><BR class="atl-forced-newline">
+<A href="the-sling-engine.html" title="The Sling Engine">The Sling Engine</A><BR class="atl-forced-newline">
+<A href="development.html" title="Development">Development</A><BR class="atl-forced-newline">
+<A href="bundles.html" title="Bundles">Bundles</A><BR class="atl-forced-newline">
+<A href="tutorials-how-tos.html" title="Tutorials & How-Tos">Tutorials &amp; How&#45;Tos</A><BR class="atl-forced-newline">
+<A href="configuration.html" title="Configuration">Configuration</A><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/apidocs/sling6/index.html" class="external-link" rel="nofollow">API docs</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.wiki" class="external-link" rel="nofollow">Wiki</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.faq" class="external-link" rel="nofollow">FAQ</A><BR class="atl-forced-newline"></P>
+
+<P><B>Project info</B><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/site/downloads.cgi" class="external-link" rel="nofollow">Downloads</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/licenses/" class="external-link" rel="nofollow">License</A><BR class="atl-forced-newline">
+<A href="contributing.html" title="Contributing">Contributing</A><BR class="atl-forced-newline">
+<A href="news.html" title="News">News</A><BR class="atl-forced-newline">
+<A href="links.html" title="Links">Links</A><BR class="atl-forced-newline">
+<A href="project-information.html" title="Project Information">Project Information</A><BR class="atl-forced-newline">
+<A href="https://issues.apache.org/jira/browse/SLING" class="external-link" rel="nofollow">Issue Tracker</A><BR class="atl-forced-newline">
+<A href="http://svn.apache.org/viewvc/sling/trunk" class="external-link" rel="nofollow">Browse Source Repository</A><BR class="atl-forced-newline">
+<A href="security.html" title="Security">Security</A><BR class="atl-forced-newline"></P>
+
+<P><B>Sponsorship</B><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/sponsorship.html" class="external-link" rel="nofollow">Become a Sponsor</A><BR>
+<A href="http://www.apache.org/foundation/buy_stuff.html" class="external-link" rel="nofollow">Buy Stuff</A></P>
+
+
+  <IFRAME src="http://www.apache.org/ads/button.html" style="border-width:0; float: left" frameborder="0" scrolling="no" width="135" height="135"></IFRAME>
+  <P style="height: 135px"></P>
+    </DIV>
+    <DIV class="main">
+        <DIV class="breadcrump" style="font-size: 80%;">
+<A href="apache-sling.html" title="Apache Sling Website">Apache Sling Website</A>&nbsp;&gt;&nbsp;<A href="apache-sling.html" title="Apache Sling">Apache Sling</A>&nbsp;&gt;&nbsp;<A href="old-stuff.html" title="Old Stuff">Old Stuff</A>&nbsp;&gt;&nbsp;<A href="scriptengineintegration.html" title="ScriptEngineIntegration">ScriptEngineIntegration</A>&nbsp;&gt;&nbsp;<A href="" title="Groovy Support">Groovy Support</A>
+        </DIV>
+
+
+<P>After meeting Paul King of the Groovy Team at Apache Con US 08 in New Orleans, I set out to take a stab at SLING-315 again to add Groovy support to Sling. It turned out, that the current Groovy 1.6 branch already contains the required setup to build the <TT>groovy-all.jar</TT> as an OSGi Bundle, which is directly usable with Sling by just installing that bundle.</P>
+
+<P>Currently the Groovy team is working hard towards the 1.6 release and many things are in flux, which is really great.</P>
+
+<P>So, on 11. Dec. 2008 Paul King of the Groovy Team has deployed a <A href="http://snapshots.repository.codehaus.org/org/codehaus/groovy/groovy-all/1.6-RC-1-SNAPSHOT/groovy-all-1.6-RC-1-20081211.113737-1.jar" class="external-link" rel="nofollow">first RC1 Snapshot of Groovy 1.6</A> which contains all the required OSGi bundle manifest headers as well das the JSR-233 <TT>ScriptEngine</TT> to use the <TT>groovy-all.jar</TT> unmodified with Sling. So just go ahead, grab the Groovy-All 1.6 RC 1 SNAPSHOT deploy it into your Sling instance and enjoy the fun of Groovy.</P>
+
+<P>If you want to be on verge of development, you might want to go for Groovy 1.7: The second SNAPSHOT of beta-1 also contains the required headers and classes and may as well be used unmodified in Sling. You may download it here: <TT><A href="http://snapshots.repository.codehaus.org/org/codehaus/groovy/groovy-all/1.7-beta-1-SNAPSHOT/groovy-all-1.7-beta-1-20081210.120632-2.jar" class="external-link" rel="nofollow">groovy-all-1.7-beta-1-20081210.120632-2.jar</A></TT>.</P>
+
+
+<P>To deploy the bundle go to the Bundles page, for example at <A href="http://localhost:8888/system/console/bundles" class="external-link" rel="nofollow">http://localhost:8888/system/console/bundles</A> of the Apache Felix Web Console select the bundle file to upload, check the <EM>Start</EM> check box and click <EM>Install or Update</EM> button.</P>
+
+<P>You may check, whether the Groovy ScriptEngine has been &quot;accepted&quot; by Sling, by going to the Script Engines page of the Apache Felix Web Console. You should see the entry for Groovy there, somthing like this:</P>
+
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
+<PRE>Groovy Scripting Engine, 2.0
+  Language      Groovy,
+  Extensions    groovy
+  MIME Types    application/x-groovy
+  Names         groovy, Groovy
+</PRE>
+</DIV></DIV>
+
+
+<H2><A name="GroovySupport-Testing"></A>Testing</H2>
+
+<P>To test create a simple Groovy script, for example</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+response.setContentType(<SPAN class="code-quote">&quot;text/plain&quot;</SPAN>);
+response.setCharacterEncoding(<SPAN class="code-quote">&quot;UTF-8&quot;</SPAN>);
+
+println <SPAN class="code-quote">&quot;Hello World !&quot;</SPAN>
+println <SPAN class="code-quote">&quot;This is Groovy Speaking&quot;</SPAN>
+println <SPAN class="code-quote">&quot;You requested the Resource ${resource} (yes, <SPAN class="code-keyword">this</SPAN> is a GString)&quot;</SPAN>
+</PRE>
+</DIV></DIV>
+
+<P>and upload it to the repository as <TT>/apps/nt/folder/GET.groovy</TT> using your favourite WebDAV client or use curl to upload the file (assuming Sling is running on localhost:8888) :</P>
+
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
+<PRE>$ curl -u admin:admin -FGET.groovy=@GET.groovy -F../../nt/jcr:primaryType=sling:Folder http:host:8888/apps/nt/folder
+</PRE>
+</DIV></DIV>
+
+<P>To test it create a <TT>/sample</TT> <TT>nt:Folder</TT> node using your favourite WebDAV client or use curl again:</P>
+
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
+<PRE>$ curl -u admin:admin -Fjcr:primaryType=nt:folder http://localhost:8888/
+</PRE>
+</DIV></DIV>
+
+
+<P>Finally, request the <TT>/sample</TT> node using your favourite Browser or use curl again:</P>
+
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
+<PRE>$ curl http://localhost:8888/sample
+Hello World !
+This is Groovy Speaking
+You requested Resource JcrNodeResource, type=nt:folder, path=/sample (yes, this is a GString)
+</PRE>
+</DIV></DIV>
+
+
+<H2><A name="GroovySupport-References"></A>References</H2>
+
+<UL>
+	<LI><A href="https://issues.apache.org/jira/browse/SLING-315" class="external-link" rel="nofollow">SLING-315</A> &ndash; The initial Sling issue proposing the addition of a Groovy ScriptEngine to Sling.</LI>
+	<LI><A href="http://markmail.org/message/7sqscr5y2mbk6jko" class="external-link" rel="nofollow">Groovy Support in Apache Sling</A> &ndash; A short thread on turning the Groovy <TT>groovy-all.jar</TT> into an OSGi Bundle.</LI>
+	<LI><A href="http://markmail.org/message/47n2ow2jlo553jvk" class="external-link" rel="nofollow">Groovy in Apache Sling</A> &ndash; Thread on adding the <TT>DynamicImport-Package</TT> header to the Groovy bundle manifest.</LI>
+</UL>
+
+        <DIV class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by fmeschbe on 2008-12-12 02:11:51.0
+        </DIV>
+        <DIV class="trademarkFooter">
+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.
+        </DIV>
+    </DIV>
+  </BODY>
+</HTML>
+

Propchange: sling/site/trunk/content/site/groovy-support.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/site/trunk/content/site/groovy-support.html
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: sling/site/trunk/content/site/groovy-support.html
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/site/trunk/content/site/guides.html
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/guides.html?rev=1420577&view=auto
==============================================================================
--- sling/site/trunk/content/site/guides.html (added)
+++ sling/site/trunk/content/site/guides.html Wed Dec 12 09:13:50 2012
@@ -0,0 +1,97 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<HTML>
+  <HEAD>
+    <TITLE>Apache Sling - Guides</TITLE>
+    <LINK rel="stylesheet" href="http://sling.apache.org/site/media.data/site.css" type="text/css" media="all">
+    <LINK rel="icon" href="http://sling.apache.org/site/media.data/favicon.ico">
+    <META http-equiv="Content-Type" content="text/html;charset=UTF-8">
+  </HEAD>
+  <BODY>
+    <DIV class="title">
+      <DIV class="logo">
+        <A href="http://sling.apache.org/site/index.html">
+          <IMG border="0" alt="Apache Sling" src="http://sling.apache.org/site/media.data/logo.png">
+        </A>
+      </DIV>
+      <DIV class="header">
+        <A href="http://www.apache.org/">
+          <IMG border="0" alt="Apache" src="http://sling.apache.org/site/media.data/apache.png">
+        </A>
+      </DIV>
+    </DIV>
+    <DIV class="menu">
+<P><B>Documentation</B><BR class="atl-forced-newline">
+<A href="getting-started.html" title="Getting Started">Getting Started</A><BR class="atl-forced-newline">
+<A href="the-sling-engine.html" title="The Sling Engine">The Sling Engine</A><BR class="atl-forced-newline">
+<A href="development.html" title="Development">Development</A><BR class="atl-forced-newline">
+<A href="bundles.html" title="Bundles">Bundles</A><BR class="atl-forced-newline">
+<A href="tutorials-how-tos.html" title="Tutorials & How-Tos">Tutorials &amp; How&#45;Tos</A><BR class="atl-forced-newline">
+<A href="configuration.html" title="Configuration">Configuration</A><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/apidocs/sling6/index.html" class="external-link" rel="nofollow">API docs</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.wiki" class="external-link" rel="nofollow">Wiki</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.faq" class="external-link" rel="nofollow">FAQ</A><BR class="atl-forced-newline"></P>
+
+<P><B>Project info</B><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/site/downloads.cgi" class="external-link" rel="nofollow">Downloads</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/licenses/" class="external-link" rel="nofollow">License</A><BR class="atl-forced-newline">
+<A href="contributing.html" title="Contributing">Contributing</A><BR class="atl-forced-newline">
+<A href="news.html" title="News">News</A><BR class="atl-forced-newline">
+<A href="links.html" title="Links">Links</A><BR class="atl-forced-newline">
+<A href="project-information.html" title="Project Information">Project Information</A><BR class="atl-forced-newline">
+<A href="https://issues.apache.org/jira/browse/SLING" class="external-link" rel="nofollow">Issue Tracker</A><BR class="atl-forced-newline">
+<A href="http://svn.apache.org/viewvc/sling/trunk" class="external-link" rel="nofollow">Browse Source Repository</A><BR class="atl-forced-newline">
+<A href="security.html" title="Security">Security</A><BR class="atl-forced-newline"></P>
+
+<P><B>Sponsorship</B><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/sponsorship.html" class="external-link" rel="nofollow">Become a Sponsor</A><BR>
+<A href="http://www.apache.org/foundation/buy_stuff.html" class="external-link" rel="nofollow">Buy Stuff</A></P>
+
+
+  <IFRAME src="http://www.apache.org/ads/button.html" style="border-width:0; float: left" frameborder="0" scrolling="no" width="135" height="135"></IFRAME>
+  <P style="height: 135px"></P>
+    </DIV>
+    <DIV class="main">
+        <DIV class="breadcrump" style="font-size: 80%;">
+<A href="apache-sling.html" title="Apache Sling Website">Apache Sling Website</A>&nbsp;&gt;&nbsp;<A href="apache-sling.html" title="Apache Sling">Apache Sling</A>&nbsp;&gt;&nbsp;<A href="" title="Guides">Guides</A>
+        </DIV>
+<P>These pages contain further information in a more informal way.</P>
+
+<UL>
+	<LI><A href="discover-sling-in-15-minutes.html" title="Discover Sling in 15 minutes">Discover Sling in 15 minutes</A> - title says it all</LI>
+</UL>
+
+
+<UL>
+	<LI><A href="resources.html" title="Resources">Resources</A> &ndash; Presents the Resource as the object around which Sling is built</LI>
+	<LI><A href="servlet-resolution.html" title="Servlet Resolution">Servlet Resolution</A> &ndash; How Sling resolves the servlet or script responsible for rendering a Resource.</LI>
+	<LI><A href="request-parameters.html" title="Request Parameters">Request Parameters</A> &ndash; Explains how Sling provides request parameters to servlets, scripts and filters.</LI>
+	<LI><A href="repository-based-development.html" title="Repository Based Development">Repository Based Development</A> &ndash; Shows how WebDAV is supported by Sling.</LI>
+</UL>
+
+
+<UL>
+	<LI><A href="installing-and-upgrading-bundles.html" title="Installing and Upgrading Bundles">Bundle Management</A> &ndash; Explains how to install, upgrade and uninstall Bundles using the Sling Management console.</LI>
+</UL>
+
+
+
+<P>These pages refer to the old Component API and launcher, and remain referred to here until more up to date documentation has been prepared:</P>
+
+<UL>
+	<LI><A href="getting-and-building-sling.html" title="Getting and Building Sling">Getting and Building Sling</A> &ndash; A short recount on the first step for getting a running Sling instance after checking out the source from the SVN repository</LI>
+	<LI><A href="default-mapping-and-rendering.html" title="Default Mapping and Rendering">Default Mapping and Rendering</A> &ndash; Explains default mapping of repository nodes to Content instances and selection of a default Component.</LI>
+	<LI><A href="dispatching-requests.html" title="Dispatching Requests">Dispatching Requests</A> &ndash; Explains how a Component may dispatch requests to include further content renderings in the response to the client's request</LI>
+</UL>
+
+        <DIV class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by fmeschbe on 2008-02-13 07:38:21.0
+        </DIV>
+        <DIV class="trademarkFooter">
+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.
+        </DIV>
+    </DIV>
+  </BODY>
+</HTML>
+

Propchange: sling/site/trunk/content/site/guides.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/site/trunk/content/site/guides.html
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: sling/site/trunk/content/site/guides.html
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/site/trunk/content/site/how-to-manage-events-in-sling.data/DropBoxEventHandler.java
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/how-to-manage-events-in-sling.data/DropBoxEventHandler.java?rev=1420577&view=auto
==============================================================================
--- sling/site/trunk/content/site/how-to-manage-events-in-sling.data/DropBoxEventHandler.java (added)
+++ sling/site/trunk/content/site/how-to-manage-events-in-sling.data/DropBoxEventHandler.java Wed Dec 12 09:13:50 2012
@@ -0,0 +1,92 @@
+
+package mypackage;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.ResourceUtil;
+import org.apache.sling.event.EventUtil;
+import org.apache.sling.event.JobProcessor;
+import org.apache.sling.jcr.api.SlingRepository;
+import org.apache.sling.jcr.resource.JcrResourceResolverFactory;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventHandler;
+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/
+ * 
+ * @scr.component  immediate="true"
+ * @scr.service interface="org.osgi.service.event.EventHandler"
+ * @scr.property name="event.topics" valueRef="mypackage.DropBoxService.JOB_TOPIC"
+ */
+
+public class DropBoxEventHandler implements JobProcessor, EventHandler {
+
+    /** Default log. */
+    protected final Logger log = LoggerFactory.getLogger(this.getClass());
+
+    /** @scr.reference */
+    private SlingRepository repository;
+    
+    /**
+     * @scr.reference
+     */
+    private JcrResourceResolverFactory 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/";
+
+	public void handleEvent(Event event) {
+	    if (EventUtil.isLocal(event)) {
+	        EventUtil.processJob(event, this);
+	    }
+	}
+
+	public boolean process(Event event) {
+		Session adminSession = null;
+		try {
+			String resourcePath = (String) event.getProperty("resourcePath");
+			String resourceName = resourcePath.substring(resourcePath.lastIndexOf("/") + 1);
+        	adminSession = repository.loginAdministrative(null);
+	        ResourceResolver resourceResolver = resolverFactory.getResourceResolver(adminSession);
+	        Resource res = resourceResolver.getResource(resourcePath);
+	        if (ResourceUtil.isA(res, "nt:file")) {
+	        	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;
+	        	}
+        		adminSession.move(resourcePath, destDir + resourceName);
+	        	adminSession.save();
+	        	log.info("The file {} has been moved to {}", resourceName, destDir);
+	        }
+	        return true;
+		} catch (RepositoryException e) {
+			log.error("RepositoryException: " + e);
+			return false;
+        } finally {
+            if (adminSession != null && adminSession.isLive()) {
+            	adminSession.logout();
+            	adminSession = null;
+            }
+        }
+	}
+}

Propchange: sling/site/trunk/content/site/how-to-manage-events-in-sling.data/DropBoxEventHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/site/trunk/content/site/how-to-manage-events-in-sling.data/DropBoxEventHandler.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Propchange: sling/site/trunk/content/site/how-to-manage-events-in-sling.data/DropBoxEventHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/site/trunk/content/site/how-to-manage-events-in-sling.data/DropBoxService.java
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/how-to-manage-events-in-sling.data/DropBoxService.java?rev=1420577&view=auto
==============================================================================
--- sling/site/trunk/content/site/how-to-manage-events-in-sling.data/DropBoxService.java (added)
+++ sling/site/trunk/content/site/how-to-manage-events-in-sling.data/DropBoxService.java Wed Dec 12 09:13:50 2012
@@ -0,0 +1,57 @@
+
+package mypackage;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.apache.sling.api.SlingConstants;
+import org.apache.sling.event.EventUtil;
+import org.apache.sling.event.JobProcessor;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventAdmin;
+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
+ * 
+ * @scr.component  immediate="true"
+ * @scr.service interface="org.osgi.service.event.EventHandler"
+ * @scr.property name="event.topics" valueRef="org.apache.sling.api.SlingConstants.TOPIC_RESOURCE_ADDED"
+ */
+public class DropBoxService implements JobProcessor, EventHandler {
+
+    /** Default log. */
+    protected final Logger log = LoggerFactory.getLogger(this.getClass());
+	
+	/** 
+	 * The OSGI event admin used for sending events 
+	 * @scr.reference
+	 */
+	private EventAdmin eventAdmin;
+	
+    /** The job topic for dropbox job events. */
+    public static final String JOB_TOPIC = "com/sling/eventing/dropbox/job";
+
+	public void handleEvent(Event event) {
+	    if (EventUtil.isLocal(event)) {
+	        EventUtil.processJob(event, this);
+	    }
+	}
+
+	public boolean process(Event event) {
+		String propPath = (String) event.getProperty(SlingConstants.PROPERTY_PATH);
+		String propResType = (String) event.getProperty(SlingConstants.PROPERTY_RESOURCE_TYPE);
+		// an event is sent if a file is added to /tmp/dropbox
+		if (propPath.startsWith("/tmp/dropbox") && propResType.equals("nt:file")) {
+    		final Dictionary<String, Object> props = new Hashtable<String, Object>();
+            props.put(EventUtil.PROPERTY_JOB_TOPIC, JOB_TOPIC);
+    		props.put("resourcePath", propPath);
+    		Event dropboxJobEvent = new Event(EventUtil.TOPIC_JOB, props);
+    		eventAdmin.sendEvent(dropboxJobEvent);
+    		log.info("the dropbox job has been sent: {}", propPath);
+		}
+		return true;
+	}
+}

Propchange: sling/site/trunk/content/site/how-to-manage-events-in-sling.data/DropBoxService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/site/trunk/content/site/how-to-manage-events-in-sling.data/DropBoxService.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Propchange: sling/site/trunk/content/site/how-to-manage-events-in-sling.data/DropBoxService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message