http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/documentation/tutorials-how-tos/testing-sling-based-applications.html ---------------------------------------------------------------------- diff --git a/documentation/tutorials-how-tos/testing-sling-based-applications.html b/documentation/tutorials-how-tos/testing-sling-based-applications.html index 778c040..3ba4016 100644 --- a/documentation/tutorials-how-tos/testing-sling-based-applications.html +++ b/documentation/tutorials-how-tos/testing-sling-based-applications.html @@ -76,22 +76,21 @@ <p>This page describes the various approaches that we use to test Sling itself, and introduces a number of tools that can help testing OSGi and HTTP-based applications.</p> <p><!-- TODO reactivate TOC once JBake moves to flexmark-java --> </p> -<h2>Unit tests</h2> +<h2><a href="#unit-tests" name="unit-tests">Unit tests</a></h2> <p>When possible, unit tests are obviously the fastest executing ones, and it's easy to keep them close to the code that they're testing. </p> <p>We have quite a lot of those in Sling, the older use the JUnit3 TestCase base class, and later ones use JUnit4 annotations. Mixing both approaches is possible, there's no need to rewrite existing tests.</p> -<h2>Tests that use a JCR repository</h2> +<h2><a href="#tests-that-use-a-jcr-repository" name="tests-that-use-a-jcr-repository">Tests that use a JCR repository</a></h2> <p>Utility classes from our <a href="https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/testing">commons/testing</a> module make it easy to get a real JCR repository for testing. That's a bit slower than pure unit tests, of course, but this only adds 1-2 seconds to the execution of a test suite.</p> <p>The <code>RepositoryProviderTest</code> in that module uses this technique to get a JCR repository.</p> <p>Note that our utilities do not cleanup the repository between tests, so you must be careful about test isolation, for example by using unique paths for each test.</p> -<h2>Mock classes and services</h2> +<h2><a href="#mock-classes-and-services" name="mock-classes-and-services">Mock classes and services</a></h2> <p>The next step is to use mock classes and services to simulate components that are needed for testing. This makes it possible to test OSGi service classes without an OSGi framework, or classes accessing the Sling or JCR API without a running Sling instance or JCR repository.</p> <p>The <a href="/documentation/development.html">Development</a> documentation page contains a section "Testing Sling-based Applications" lising all mock implementations available as part of the Apache Sling project.</p> <p>In other cases we use <a href="http://www.jmock.org/">jmock</a> or <a href="https://code.google.com/p/mockito/">Mockito</a> to help create mock objects without having to write much code - such mocking libraries take care of the plumbing and allow you to write just the bits of code that matter (often with funny syntaxes). The tests of the <a href="https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/event/">org.apache.sling.event</a> bundle, for example, make extensive use of such mock services.</p> <p>The problem with mocks is that it can become hard to make sure you're actually testing something, and not just "mocking mocks". At a certain level of complexity, it becomes quicker and clearer to actually start an OSGi framework for automated tests.</p> -<h3>Side note: injecting services in private fields</h3> +<h3><a href="#side-note-injecting-services-in-private-fields" name="side-note-injecting-services-in-private-fields">Side note: injecting services in private fields</a></h3> <p>To inject (real or fake) services in others for testing, without having to create getters and setters just for this, you could use a reflection-based trick, as in the below example. Utilities such as the <a href="http://junit-addons.sourceforge.net/junitx/util/PrivateAccessor.html">PrivateAccessor</a> from <a href="http://junit-addons.sourceforge.net/">junit-addons</a> make that simpler.</p> -<pre><code>#!java -// set resource resolver factory +<pre><code><!-- TODO syntax marker (#!java) disabled -->// set resource resolver factory // in a ServletResolver object which has a private resourceResolverFactory field ServletResolver servletResolver = .... @@ -100,29 +99,27 @@ final java.lang.reflect.Field resolverField = resolverClass.getDeclaredField(&qu resolverField.setAccessible(true); resolverField.set(servletResolver, factory); </code></pre> -<h2>Pax Exam</h2> +<h2><a href="#pax-exam" name="pax-exam">Pax Exam</a></h2> <p><a href="http://team.ops4j.org/wiki/display/paxexam/Pax+Exam">Pax Exam</a> allows you to easily start an OSGi framework during execution of a JUnit test suite.</p> <p>We currently use it for our <a href="https://svn.apache.org/repos/asf/sling/trunk/installer/it">Sling installer integration tests</a> for example. As parts of the installer interact directly with the OSGi framework, it felt safer to test it in a realistic situation rather than mock everything.</p> <p>Such tests are obviously slower than plain unit tests and tests that use mocks. Our installer integration tests, using Pax Exam, take about a minute to execute on a 2010 macbook pro.</p> -<h2>Server-side JUnit tests</h2> +<h2><a href="#server-side-junit-tests" name="server-side-junit-tests">Server-side JUnit tests</a></h2> <p>The tools described on the <a href="/documentation/bundles/org-apache-sling-junit-bundles.html">JUnit server-side testing support</a> page allow for running JUnit tests on an live Sling instance, as part of the normal integration testing cycle. </p> -<h2>HTTP-based integration tests</h2> +<h2><a href="#http-based-integration-tests" name="http-based-integration-tests">HTTP-based integration tests</a></h2> <p>The <a href="https://svn.apache.org/repos/asf/sling/trunk/testing/junit/rules">Sling HTTP Testing Rules</a> allow writing integration tests easily. They are primarily meant to be used for tests that use http against a Sling instance and make use of the <a href="https://svn.apache.org/repos/asf/sling/trunk/testing/http/clients">org.apache.sling.testing.clients</a> which offer a simple, immutable and extendable way of working with specialized testing clients.</p> <p>The JUnit rules incorporate boiler-plate logic that is shared in tests and take the modern approach of using rules rather than inheritance. The <code>SlingRule</code> (for methods) or <code>SlingClassRule</code> (for test classes) are base rules, chaining other rules like <code>TestTimeoutRule</code>, <code>TestDescriptionRule</code>, <code>FilterRule</code>. The <code>SlingInstanceRule</code> extends that and starts a Sling instance if needed and also allows instantiating a <code>SlingClient</code> pointing to the instance and automatically configure the base url, credentials, etc.</p> <h3><a name="starting"></a> Starting an Integration Test</h3> <p>Starting an integration is very simple out of the box, but is very extendable, both by combining or configuring the junit rules and by using the versatile <code>SlingClient</code> (which can be extended or adapted by calling <code>adaptTo(MyClient.class)</code> without losing the client configuration)</p> <p>The <a href="https://svn.apache.org/repos/asf/sling/trunk/testing/junit/rules/README.md">README</a> provides more detail, as do <a href="https://svn.apache.org/repos/asf/sling/trunk/testing/junit/rules/src/test/java">the tests</a>. The <a href="https://svn.apache.org/repos/asf/sling/trunk/testing/http/clients">Sling HTTP Testing Clients</a> provide simple explanations, and unit tests.</p> -<h4>Maven Dependency</h4> -<pre><code>#!xml -<dependency> +<h4><a href="#maven-dependency" name="maven-dependency">Maven Dependency</a></h4> +<pre><code><!-- TODO syntax marker (#!xml) disabled --><dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.testing.rules</artifactId> <version>0.1.0-SNAPSHOT</version> </dependency> </code></pre> -<h4>Simple Example using SlingInstanceRule</h4> -<pre><code>#!java -public class MySimpleIT { +<h4><a href="#simple-example-using-slinginstancerule" name="simple-example-using-slinginstancerule">Simple Example using SlingInstanceRule</a></h4> +<pre><code><!-- TODO syntax marker (#!java) disabled -->public class MySimpleIT { @ClassRule public static SlingInstanceRule instanceRule = new SlingInstanceRule(); @@ -139,7 +136,7 @@ public class MySimpleIT { } } </code></pre> -<h2>Summary</h2> +<h2><a href="#summary" name="summary">Summary</a></h2> <p>Combining the above testing techniques has worked well for us in creating and testing Sling. Being able to test things at different levels of integration has proved an efficient way to get good test coverage without having to write too much boring test code.</p></section></div></div> <div class="footer"> <div class="trademarkFooter">
http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/downloads.html ---------------------------------------------------------------------- diff --git a/downloads.html b/downloads.html index a95c5b4..668d523 100644 --- a/downloads.html +++ b/downloads.html @@ -75,7 +75,7 @@ </h1><div class="row"><div class="small-12 columns"><section class="wrap"><header><h1>Downloads</h1></header><p>To get the latest development release of Apache Sling, you can check out the Source Code and Getting and Building Sling yourself. Otherwise, the releases below are available for download. To install, just download and extract. The PGP keys at <a href="./https%3A%2F%2Fpeople.apache.org%2Fkeys%2Fgroup%2Fsling.asc.html">https://people.apache.org/keys/group/sling.asc</a> can be used to verify the integrity of the release archives.</p> <p>All Apache Sling products are distributed under the terms of The Apache Software License (version 2.0). See our license, or the LICENSE file included in each distribution. </p> <p>TODO ToC ??</p> -<h1>Mirrors</h1> +<h1><a href="#mirrors" name="mirrors">Mirrors</a></h1> <p>Use the links below to download binary or source distributions of Apache Sling from one of our mirrors.</p> <p>You are currently using <strong>[preferred]</strong>. If you encounter a problem with this mirror, please select another mirror. If all mirrors are failing, there are backup mirrors (at the end of the mirrors list) that should be available. If the mirror displayed above is labeled <em>preferred</em>, then please reload this page by [downloads.cgi](clicking here)</p> <form action="[location]" method="get" id="SelectMirror"> http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/feed.xml ---------------------------------------------------------------------- diff --git a/feed.xml b/feed.xml index d96a255..6becdd9 100644 --- a/feed.xml +++ b/feed.xml @@ -4,7 +4,7 @@ <link href="http://sling.apache.org/ng/"/> <link rel="self" type="application/atom+xml" href="http://sling.apache.org/ng/feed.xml"/> <subtitle>Work in progress...</subtitle> - <updated>2017-06-29T09:44:46Z</updated> - <id>tag:localhost,2017:06</id> + <updated>2017-07-11T14:35:58Z</updated> + <id>tag:localhost,2017:07</id> </feed> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/index.html ---------------------------------------------------------------------- diff --git a/index.html b/index.html index a580a20..96fc308 100644 --- a/index.html +++ b/index.html @@ -74,7 +74,7 @@ Apache Sling - Bringing Back the Fun! </h1><div class="row"><div class="small-12 columns"><section class="wrap"><p><strong>Apache Sling™</strong> is an innovative web framework that is intended to bring back the fun to web development.</p> <p>Discussions about Sling happen on our mailing lists, see the <a href="/project-information.html">Project Information</a> page for more info.</p> -<h1>Apache Sling in five bullets points</h1> +<h1><a href="#apache-sling-in-five-bullets-points" name="apache-sling-in-five-bullets-points">Apache Sling in five bullets points</a></h1> <ul> <li>REST based web framework</li> <li>Content-driven, using a JCR content repository</li> @@ -82,40 +82,40 @@ <li>Scripting inside, multiple languages (JSP, server-side javascript, Scala, etc.)</li> <li>Apache Open Source project</li> </ul> -<h1>Apache Sling in a hundred words</h1> +<h1><a href="#apache-sling-in-a-hundred-words" name="apache-sling-in-a-hundred-words">Apache Sling in a hundred words</a></h1> <p>Apache Sling is a web framework that uses a <a href="http://en.wikipedia.org/wiki/JSR-170">Java Content Repository</a>, such as <a href="http://jackrabbit.apache.org/">Apache Jackrabbit</a>, to store and manage content.</p> <p>Sling applications use either scripts or Java servlets, selected based on simple name conventions, to process HTTP requests in a RESTful way.</p> <p>The embedded <a href="http://felix.apache.org/">Apache Felix</a> OSGi framework and console provide a dynamic runtime environment, where code and content bundles can be loaded, unloaded and reconfigured at runtime.</p> <p>As the first web framework dedicated to <a href="http://jcp.org/en/jsr/detail?id=170">JSR-170</a> Java Content Repositories, Sling makes it very simple to implement simple applications, while providing an enterprise-level framework for more complex applications. </p> -<h2>News</h2> +<h2><a href="#news" name="news">News</a></h2> <ul id="newsExcerpt"> </ul> <p>Refer to the news <a href="/news.html">archive</a> for all news.</p> -<h2>History</h2> +<h2><a href="#history" name="history">History</a></h2> <p>Sling started as an internal project at <a href="http://www.day.com">Day Software</a> , and entered the Apache Incubator in September 2007. As of June, 17th, 2009 Apache Sling is a top level project of the Apache Software Foundation.</p> <p>The name "Sling" has been proposed by Roy Fielding who explained it like this:</p> <blockquote> <p>[The name is] Biblical in nature. The story of David: the weapon he uses to slay the giant Goliath is a sling. Hence, our David's [David Nuescheler, CTO of Day Software] favorite weapon.</p> <p>It is also the simplest device for delivering content very fast.</p> </blockquote> -<h2>Getting started</h2> +<h2><a href="#getting-started" name="getting-started">Getting started</a></h2> <p>If you prefer doing rather than reading, please proceed to <a href="/documentation/getting-started/discover-sling-in-15-minutes.html">Discover Sling in 15 minutes</a> or read through the recommended links in the <a href="/documentation/getting-started.html">Getting Started</a> section, where you can quickly get started on your own instance of Sling.</p> -<h2>Use Cases for Sling</h2> -<h4>Wiki</h4> +<h2><a href="#use-cases-for-sling" name="use-cases-for-sling">Use Cases for Sling</a></h2> +<h4><a href="#wiki" name="wiki">Wiki</a></h4> <p>Day built a Wiki system on Sling. Each Wiki page is a node (with optional child nodes) in the repository. As a page is requested, the respective node is accessed and through the applying Component is rendered.</p> <p>Thanks to the JCR Mapping and the resolution of the Component from the mapped Content, the system does not care for what actual node is addressed as long as there is a Content mapping and a Component capable of handling the Content.</p> <p>Thus in the tradition of REST, the attachement of a Wiki page, which happens to be in a node nested below the wiki page node is easily accessed using the URL of the wiki page attaching the relative path of the attachement ode. The system resolves the URL to the attachement Content and just calls the attachement's Component to spool the attachement.</p> -<h4>Digital Asset Management</h4> +<h4><a href="#digital-asset-management" name="digital-asset-management">Digital Asset Management</a></h4> <p>Day has implemented a Digital Asset Management (DAM) Application based on Sling. Thanks to the flexibility of the Content/Component combo as well as the service registration/access functionality offered by OSGi, extending DAM for new content type is merely a matter of implementing one or two interfaces and registering the respective service(s).</p> <p>Again, the managed assets may be easily spooled by directly accessing them.</p> -<h4>Web Content Management</h4> +<h4><a href="#web-content-management" name="web-content-management">Web Content Management</a></h4> <p>Last but not least, Sling offers itself very well to implementing a Web Content Management system. Thanks to the flexibility of rendering the output - remember: the system does not care what to render, as long as the URL resolves to a Content object for which a Component exists, which is called to render the Content - providing support for Web Content authors (not PHP programmers but users out in the field) to build pages to their likings can easily be done.</p> -<h2>References</h2> -<h4>Apache Jackrabbit</h4> +<h2><a href="#references" name="references">References</a></h2> +<h4><a href="#apache-jackrabbit" name="apache-jackrabbit">Apache Jackrabbit</a></h4> <p>The main purpose of Sling is to develop a content-centric Web Application framework for Java Content Repository (JCR) based data stores. Sling is implemented - with the notable exception of JCR Node Type management - purely in terms of the JCR API and as such may use any JCR compliant repository. The default implementation for <a href="http://jackrabbit.apache.org">Apache Jackrabbit</a> is provided out of the box.</p> -<h4>OSGi</h4> +<h4><a href="#osgi" name="osgi">OSGi</a></h4> <p>Sling is implemented as a series of <a href="http://www.osgi.org">OSGi</a> Bundles and makes extensive use of the OSGi functionality, such as lifecycle management and the service layer. In addition, Sling requires several OSGi compendium services to be available, such as the Log Service, Http Service, Configuration Admin Service, Metatype Service, and Declarative Services.</p> -<h4>Apache Felix</h4> +<h4><a href="#apache-felix" name="apache-felix">Apache Felix</a></h4> <p>While Sling does not require a specific OSGi framework implementation to run in, Sling is being developed using <a href="http://felix.apache.org">Apache Felix</a> as the OSGi framework implementation. It has not been tested yet, but it is expected that Sling also operates perfectly inside other OSGi frameworks such as <a href="http://www.eclipse.org/equinox">Equinox</a> and <a href="http://www.knopflerfish.org">Knopflerfish</a>.</p> <script src="/res/jquery.js" type="text/javascript"></script> <script type="text/javascript"> http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/links.html ---------------------------------------------------------------------- diff --git a/links.html b/links.html index 1de8d4c..24ed529 100644 --- a/links.html +++ b/links.html @@ -73,13 +73,13 @@ <div class="breadcrumbs"><a href="/ng/">Home</a> » </div> <h1> Links </h1><div class="row"><div class="small-12 columns"><section class="wrap"><p>Here are some links to other resources</p> -<h2>Articles</h2> +<h2><a href="#articles" name="articles">Articles</a></h2> <ul> <li><a href="http://java.dzone.com/articles/java-content-repository-best">Java Content Repository: The Best Of Both Worlds</a> - by Bertrand Delacretaz on Javalobby - uses the Sling HTTP interface to demonstrate JCR features.</li> <li><a href="http://www.lucamasini.net/Home/sling-and-cq5/accessing-relational-data-as-sling-restful-urls">Accessing Relational Data as SLING RESTful URLs</a> - by Luca Masini</li> <li><a href="http://confluence.sakaiproject.org/display/KERNDOC/Your+First+Day+With+Sakai+Nakamura">Your First Day With Sakai Nakamura</a> - Sakai Nakamura is based on Sling, that introductory article has very good explanations of REST and Sling basics, and on why hierarchies are useful on the Web.</li> </ul> -<h2>About Sling</h2> +<h2><a href="#about-sling" name="about-sling">About Sling</a></h2> <ul> <li><a href="http://dev.day.com/microsling/content/blogs/main.html?category=sling">Sling on dev.day.com</a> - Day's developers blog, regularly includes articles on Sling and JCR. Powered by Sling, of course.</li> <li><a href="http://weblogs.goshaky.com/weblogs/lars/tags/sling">Sling on Lars Trieloff's Blog</a> - Lars regularly writes on his experiences with Sling. Most notably the mini series of three entries introducing Sling and microsling.</li> @@ -88,11 +88,11 @@ <li><a href="https://www.ohloh.net/p/sling">Sling on ohloh</a> - activity and community statistics.</li> <li><a href="http://sling.markmail.org/">Sling on MarkMail</a> - searchable mailing list archives.</li> </ul> -<h2>Projects using Sling</h2> +<h2><a href="#projects-using-sling" name="projects-using-sling">Projects using Sling</a></h2> <ul> <li>Gert Vanthienen succeeded in installing Sling into the new Apache ServiceMix kernel and documented his experience <a href="http://servicemix.apache.org/SMX4KNL/running-apache-sling-on-servicemix-kernel.html">Sling On ServiceMix Kernel</a></li> </ul> -<h2>Sling Presentations and Screencasts</h2> +<h2><a href="#sling-presentations-and-screencasts" name="sling-presentations-and-screencasts">Sling Presentations and Screencasts</a></h2> <ul> <li><a href="http://www.slideshare.net/tag/sling">Presentations tagged with "sling" at slideshare</a></li> </ul> @@ -101,17 +101,17 @@ <li><a href="http://dev.day.com/microsling/content/blogs/main/firststeps1.html">First Steps with CRX Quickstart</a></li> <li><a href="http://dev.day.com/microsling/content/blogs/main/firststeps2.html">TheServerSide.com in 15 minutes</a></li> </ul> -<h2>From ApacheCon EU 08</h2> +<h2><a href="#from-apachecon-eu-08" name="from-apachecon-eu-08">From ApacheCon EU 08</a></h2> <ul> <li><a href="/res/docs/ApacheConEU08_FFT_Sling.pdf">ApacheCon EU 08 Fast Feather Track Presentation on Sling</a></li> <li><a href="/res/docs/ApacheConEU08_JCR_Meetup_Sling_Architecture.pdf">JCR Meetup Presentation on Sling Architecture</a></li> </ul> -<h2>From ApacheCon US 07</h2> +<h2><a href="#from-apachecon-us-07" name="from-apachecon-us-07">From ApacheCon US 07</a></h2> <ul> <li><a href="/res/docs/ApacheConUS07_FFT_Sling.pdf">ApacheCon US 07 Fast Feather Track Presentation on Sling</a></li> <li><a href="http://feathercast.org/?p=59">Feathercast On Day 4 with an interview on Sling with Felix</a></li> </ul> -<h2>Technology used by Sling</h2> +<h2><a href="#technology-used-by-sling" name="technology-used-by-sling">Technology used by Sling</a></h2> <ul> <li><a href="http://jackrabbit.apache.org">Apache Jackrabbit</a> - The reference implementation of the Content Repository for Java (JCR) Specification. This implementation is used in Sling as the primary repository.</li> <li><a href="http://www.jcp.org/en/jsr/detail?id=170">JSR 170: Content Repository for Java{tm} technology API</a> - The specification of the repository API.</li> http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/news/sling-ide-tooling-11-released.html ---------------------------------------------------------------------- diff --git a/news/sling-ide-tooling-11-released.html b/news/sling-ide-tooling-11-released.html index bad260a..5db6a76 100644 --- a/news/sling-ide-tooling-11-released.html +++ b/news/sling-ide-tooling-11-released.html @@ -73,7 +73,7 @@ <div class="breadcrumbs"><a href="/ng/">Home</a> » <a href="/ng/news.html">News</a> » </div> <h1> Apache Sling IDE Tooling 1.1 released </h1><div class="row"><div class="small-12 columns"><section class="wrap"><p>Here are some of the more noteworthy things available in this release.</p> -<h1>Sightly support</h1> +<h1><a href="#sightly-support" name="sightly-support">Sightly support</a></h1> <p>Sightly support has been added through an additional, optional, feature named <em>Sling IDE Tools - Sightly Integration</em>.</p> <p>This feature provides the following enhancements:</p> <ul> @@ -83,13 +83,13 @@ </ul> <p><img src="/documentation/development/ide-tooling/sightly-editor.png" alt="Sightly Editor" /></p> <p>These enhancements are enabled once the Sightly facet is added to a project. This is done automatically when converting a project to content project, but can also be done manually via the project properties, under the <em>Project Facets</em> page.</p> -<h1>Automatic configuration of debug classpath based on the bundles deployed on the server</h1> +<h1><a href="#automatic-configuration-of-debug-classpath-based-on-the-bundles-deployed-on-the-server" name="automatic-configuration-of-debug-classpath-based-on-the-bundles-deployed-on-the-server">Automatic configuration of debug classpath based on the bundles deployed on the server</a></h1> <p>When first connecting to a Sling instance, the IDE tooling tries to bind all the sources associated with the bundles deployed on the server and retrieves the associated source artifacts using Maven. Therefore, the debug classpath is as close as possible to sources used to build the bundles deployed on the server.</p> <p><img src="/documentation/development/ide-tooling/debug.png" alt="Debugging" /></p> <p>Since a first source bundle resolution can potentially take a long time, this behaviour can be disabled from the server configuration page.</p> -<h1>Maven configurator for content-package projects</h1> +<h1><a href="#maven-configurator-for-content-package-projects" name="maven-configurator-for-content-package-projects">Maven configurator for content-package projects</a></h1> <p>Maven projects configured using the <code>com.day.jcr.vault:content-package-maven-plugin</code> are now automatically configured as content projects, removing the need to manually add the needed facets after importing them into Eclipse for the first time.</p> -<h1>Other minor improvements</h1> +<h1><a href="#other-minor-improvements" name="other-minor-improvements">Other minor improvements</a></h1> <ul> <li>Keyboard shortcuts now work in the content navigator</li> <li>When creating a new server in the project creation wizard, sensible defaults are filled in</li> http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/news/sling-launchpad-8-released.html ---------------------------------------------------------------------- diff --git a/news/sling-launchpad-8-released.html b/news/sling-launchpad-8-released.html index 8e61f8a..b8e0d46 100644 --- a/news/sling-launchpad-8-released.html +++ b/news/sling-launchpad-8-released.html @@ -73,11 +73,11 @@ <div class="breadcrumbs"><a href="/ng/">Home</a> » <a href="/ng/news.html">News</a> » </div> <h1> Apache Sling Launchpad 8 released </h1><div class="row"><div class="small-12 columns"><section class="wrap"><p>Here are some of the more noteworthy things available in this release.</p> -<h2>Switched to Apache Jackrabbit Oak</h2> +<h2><a href="#switched-to-apache-jackrabbit-oak" name="switched-to-apache-jackrabbit-oak">Switched to Apache Jackrabbit Oak</a></h2> <p>The Sling launchpad has switched from Apache Jackrabbit 2.7.5 to Apache Jackrabbit Oak 1.3.7 as a persistence engine. Apache Jackrabbit Oak is now supported in Sling with two persistence modes: SegmentNodeStore ( file-based ) and DocumentNodeStore ( MongoDB-based ). See <a href="http://jackrabbit.apache.org/oak/docs/index.html">the Oak documentation</a> for more details about the Oak persistence modes and <a href="https://sling.apache.org/documentation/the-sling-engine/the-sling-launchpad.html#launchpad-app-and-launchpad-webapp">the Sling Launchpad documentation</a> for details about configuring the persistence mode.</p> -<h2>Provisioning model</h2> +<h2><a href="#provisioning-model" name="provisioning-model">Provisioning model</a></h2> <p>Sling is now provisioned using a simple, text-based, model. See See <a href="http://sling.apache.org/documentation/development/slingstart.html">the Sling Provisioning Model documentation</a> for details.</p> -<h2>Sightly</h2> +<h2><a href="#sightly" name="sightly">Sightly</a></h2> <p>Sightly is an HTML templating language, similar to JSP (Java Server Pages) and ESP (ECMAScript Server Pages). The name âSightlyâ (meaning âpleasing to the eyeâ) highlights its focus on keeping your markup beautiful, and thus maintainable, once made dynamic.</p> <p>The cornerstones of Sightly are:</p> <ul> @@ -86,15 +86,15 @@ <li>Built on HTML 5: A Sightly file is itself a valid HTML5 file. All Sightly-specific syntax is expressed either within a data attribute, or within HTML text.</li> </ul> <p>See <a href="https://github.com/Adobe-Marketing-Cloud/htl-spec/blob/master/SPECIFICATION.md">the Sightly HTML Templating Language Specification</a> for details.</p> -<h2>Versioning support in the Resource API</h2> +<h2><a href="#versioning-support-in-the-resource-api" name="versioning-support-in-the-resource-api">Versioning support in the Resource API</a></h2> <p>The Java Resource API and the HTTP API are now able to work with versioned resources. See <a href="https://issues.apache.org/jira/browse/SLING-848">SLING-848 - Support getting versioned resources by using uri path parameters</a> for more details.</p> -<h2>Improved testing tools</h2> +<h2><a href="#improved-testing-tools" name="improved-testing-tools">Improved testing tools</a></h2> <p>The Sling testing tools have seen numerous additions since the last release, including a family of Mock libraries known as the Sling Mocks and a Teleporter JUnit module for running Sling tests in provisioned Sling instances. For more details, see the documentation on <a href="https://sling.apache.org/documentation/bundles/org-apache-sling-junit-bundles.html">JUnit server-side testing support bundles</a> and <a href="https://sling.apache.org/documentation/development/sling-mock.html">Sling Mocks</a> .</p> -<h2>Servlet API 3.0</h2> +<h2><a href="#servlet-api-3-0" name="servlet-api-3-0">Servlet API 3.0</a></h2> <p>Sling now uses and requires Servlet API 3.0. See <a href="https://jcp.org/en/jsr/detail?id=315">JSR 315: JavaTM Servlet 3.0 Specification</a> for details.</p> -<h2>Performance</h2> +<h2><a href="#performance" name="performance">Performance</a></h2> <p>Various performance and concurrency improvements were added to the Engine and JCR Resource bundles.</p> -<h2>Dependency updates</h2> +<h2><a href="#dependency-updates" name="dependency-updates">Dependency updates</a></h2> <p>Some of the notable dependency updates are:</p> <ul> <li>Apache Felix has been upgraded to version 5.2.0</li> http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/news/sling-launchpad-9-released.html ---------------------------------------------------------------------- diff --git a/news/sling-launchpad-9-released.html b/news/sling-launchpad-9-released.html index 1c76c87..357195c 100644 --- a/news/sling-launchpad-9-released.html +++ b/news/sling-launchpad-9-released.html @@ -73,35 +73,35 @@ <div class="breadcrumbs"><a href="/ng/">Home</a> » <a href="/ng/news.html">News</a> » </div> <h1> Apache Sling Launchpad 9 released </h1><div class="row"><div class="small-12 columns"><section class="wrap"><p>Here are some of the more noteworthy things available in this release.</p> -<h2>Updated to Oak 1.6.1 and segment-tar persistence</h2> +<h2><a href="#updated-to-oak-1-6-1-and-segment-tar-persistence" name="updated-to-oak-1-6-1-and-segment-tar-persistence">Updated to Oak 1.6.1 and segment-tar persistence</a></h2> <p>We now include the latest stable version of Oak and have switched to the latest form of the disk-based persitence - oak-segment-tar. This module provides better runtime characteristics when compared to the oak-segment persistence and also allows reliable online compaction of the repository.</p> <p>If you're upgrading from a previous version of Sling you will need to manually upgrade the repository. See the <a href="http://jackrabbit.apache.org/oak/docs/migration.html">Oak documentation on Repository migration</a> for more details.</p> -<h2>The Sling Explorer is replaced with Composum</h2> +<h2><a href="#the-sling-explorer-is-replaced-with-composum" name="the-sling-explorer-is-replaced-with-composum">The Sling Explorer is replaced with Composum</a></h2> <p>The Sling Launchpad ships with a new repository explorer and administration tool - <a href="https://github.com/ist-dresden/composum">Composum</a>. Composum is more reliable and featureful compared to the previous Sling explorer.</p> -<h2>The Slingshot sample is included</h2> +<h2><a href="#the-slingshot-sample-is-included" name="the-slingshot-sample-is-included">The Slingshot sample is included</a></h2> <p>The default Sling configuration now includes the Slingshot sample. Slingshot exemplifies how to build and deploy a Sling application.</p> -<h2>New Resource Provider and Observation API</h2> +<h2><a href="#new-resource-provider-and-observation-api" name="new-resource-provider-and-observation-api">New Resource Provider and Observation API</a></h2> <p>The Resource Provider API has been replaced with a new implementation, which is more performant and better suited for future evolution. Existing ResourceProvider will be able to work using a backwards-compatible layer, but developers are nonetheless encouraged to move to the new implementation.</p> <p>In the same manner, the Observation API has been refreshed.</p> -<h2>New modules added: Validation, Context-Aware Configuration, Repository Initialization Language</h2> +<h2><a href="#new-modules-added-validation-context-aware-configuration-repository-initialization-language" name="new-modules-added-validation-context-aware-configuration-repository-initialization-language">New modules added: Validation, Context-Aware Configuration, Repository Initialization Language</a></h2> <p>A number of new general-purpose modules have been added to the Sling Launchpad:</p> <ul> <li><a href="/documentation/bundles/validation.html">Validation</a></li> <li><a href="/documentation/bundles/context-aware-configuration/context-aware-configuration.html">Context-Aware configuration</a></li> <li><a href="/documentation/bundles/repository-initialization.html">Repository Initialization Language</a></li> </ul> -<h2>Tooling: HTL Maven Plugin</h2> +<h2><a href="#tooling-htl-maven-plugin" name="tooling-htl-maven-plugin">Tooling: HTL Maven Plugin</a></h2> <p>The <a href="http://sling.apache.org/components/htl-maven-plugin/">HTL Maven Plugin</a> provides build-time validation for projects using HTL. Furthermore, the HTL engine has been modularised into an HTL Compiler, an HTL Java Compiler and an HTL Script Engine, with the first two allowing to build other HTL tools in a Sling-independent way.</p> -<h2>Streaming Upload Support</h2> +<h2><a href="#streaming-upload-support" name="streaming-upload-support">Streaming Upload Support</a></h2> <p>The version of the Sling Engine shipped in the Launchpad now supports streaming uploads, for better I/O throughput. Streaming uploads are opt-in via setting the following HTTP Header:</p> <pre><code>Sling-UploadMode: stream </code></pre> -<h2>Discovery: added Oak-based discovery implementation</h2> +<h2><a href="#discovery-added-oak-based-discovery-implementation" name="discovery-added-oak-based-discovery-implementation">Discovery: added Oak-based discovery implementation</a></h2> <p>The Sling discovery mechanism has been augmented with a mechanism which delegates instance discovery to Oak. When working with a DocumentNodeStore-based Oak implementation, this information is already available to Oak so there is no point in duplicating the work.</p> -<h2>Security: loginAdministrative deprecation</h2> +<h2><a href="#security-loginadministrative-deprecation" name="security-loginadministrative-deprecation">Security: loginAdministrative deprecation</a></h2> <p>We believe that the vast majority of bundles performing background work do not require administrative access to the repository via <code>loginAdministrative</code>. We have removed many usages of <code>loginAdministrative</code> in the Sling code and replaced then with a service-based approach - <code>loginService</code>. We encourage you to do the same.</p> <p>Documentation available at <a href="/documentation/the-sling-engine/service-authentication.html">Service Authentication</a>.</p> -<h2>Removed org.apache.sling.commons.json and org.json bundles</h2> +<h2><a href="#removed-org-apache-sling-commons-json-and-org-json-bundles" name="removed-org-apache-sling-commons-json-and-org-json-bundles">Removed org.apache.sling.commons.json and org.json bundles</a></h2> <p>Apache projects are no longer allowed, for legal reasons, to ship code which uses or links to the JSON.org Java implementation. As a consequence we have removed all code which references that API.</p> <p>If you need to use these bundles, you can always retrieve then from Maven Central and incorporate them in your launchpad.</p></section></div></div> <div class="footer"> http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/old-stuff/assembly.html ---------------------------------------------------------------------- diff --git a/old-stuff/assembly.html b/old-stuff/assembly.html index 8181283..95dc334 100644 --- a/old-stuff/assembly.html +++ b/old-stuff/assembly.html @@ -73,23 +73,23 @@ <div class="breadcrumbs"><a href="/ng/">Home</a> » <a href="/ng/old-stuff.html">Old Stuff</a> » </div> <h1> Assembly </h1><div class="row"><div class="small-12 columns"><section class="wrap"><p>The Assembly concept grew out of a need to bundle together a set of OSGi Bundles to deploy applications. The concept has been developped before the OSGi Deployment Package Service Specification has been published in the Release 4.1 Compendium Services Specification. It will have to be discussed whether the Assembly concept is dropped in favor of the Deplyoment Package Service.</p> -<h2>Introduction</h2> +<h2><a href="#introduction" name="introduction">Introduction</a></h2> <p>This chapter discusses the units of deployment as well as the units of functionality. The following contents is based on the Module and Service specifications of the OSGi Service Platform Core Specification, Release 4 but enhances functionality for ease of use and in terms of best practices.</p> <p>The term <em>Units of Deployment</em> describes the idea of packaging up functionality implemented by Java Classes into modules, so called <em>Bundles</em>. For bigger and more complicated applications the fine grained modularity of <em>Bundles</em> may be to complicated, so this chapter proposes an extension called <em>Assembly</em>. The goal of the <em>Assembly</em> specification presented below is to provide functionality to delivery a collection of bundles belonging together.</p> <p>The term <em>Units of Functionality</em> describes the idea of providing services implemented by Java Classes, so called <em>Services</em>. A <em>Service</em> is an abstraction and does not actually prescribe the implementation of specific interfaces. Instead the OSGi specification states how functionality may be provided to clients by registering objects implementing interfaces defining the functionality in terms of a Java API.</p> -<h2>Bundles</h2> +<h2><a href="#bundles" name="bundles">Bundles</a></h2> <p>The core unit of deployment is the <em>Bundle</em>. The OSGi core specification defines a <em>Bundle</em> to be a Java Archive (JAR) file whose manifest - the <code>META-INF/MANIFEST.MF</code> file - contains specific headers identifying the bundle. Most manifest headers are optional with defined default values - only the <code>Bundle-SymbolicName</code> header is actually required and the <code>Bundle-ManifestVersion</code> header should be set to <code>2</code> to identify the bundle to be a R4 bundle. Other information defined in the manifest is the bundle version, the list of packages exported - provided to other bundles - and imported - used and required to be provided by other bundles. See chapter <em>3.2.1 Bundle Manifest Header</em> of the OSGi Service Platform Core Specification for a complete list of the defined bundle manifest headers.</p> <p>Bundles may be installed, updated , started, stopped and removed in an OSGi framework individually.</p> -<h2>Assemblies</h2> +<h2><a href="#assemblies" name="assemblies">Assemblies</a></h2> <p>For the deployment of bigger systems, the number of bundles may increase very quickly. To ease the management of products consisting of multiple bundles, this chapter introduces the <em>Assembly</em>. An Assembly is simply a collection of bundles deployed together. An Assembly - like a Bundle - is a JAR file whose manifest contains specific headers. In fact, an Assembly is just a standard bundle, with additional functionality.</p> <p>Assemblies are managed by the <em>Assembly Manager</em> which itself is a bundle installed into the framework.</p> -<h3>Assembly manifest headers</h3> +<h3><a href="#assembly-manifest-headers" name="assembly-manifest-headers">Assembly manifest headers</a></h3> <p>As an Assembly is a standard Bundle, all the defined Bundle manifest headers may be specified. In addition, for the <em>Assembly Manager</em> to recognize an assembly and for the OSGi Bundle Repository to support dependency resolution, the following manifest headers are defined. All headers are optional with documented default values except where noted.</p> <ul> <li><strong>Assembly-Bundles</strong> - The list of bundles contained in this assembly. See below for the definition of the syntax of this header. This header is required. The presence of this headers identifies an Assembly to the <em>Assembly Manager</em>.</li> <li><strong>Assembly-BundleRepository</strong> - A comma-separated list of URLs pointing to OSGi Bundle Repository descriptors. These bundle repositories will be used to install bundles listed in the <code>Assembly-Bundles</code> header. This header is optional with not default value.</li> </ul> -<h3>Assembly Lifecycle</h3> +<h3><a href="#assembly-lifecycle" name="assembly-lifecycle">Assembly Lifecycle</a></h3> <p>An Assembly, like all bundles, may be in any of the defined bundle states:</p> <ul> <li><strong>Installed</strong> - The Assembly bundle has been installed into the system but not yet resolved. The <em>Assembly Manager</em> will try to install all bundles listed in the <code>Assembly-Bundles</code> header. The start levels of the bundles will be set according to the <code>startlevel</code> parameter. The bundles will not be started. If installation of one or more of the bundles fails, <em>Assembly Manager</em> logs an error message.</li> @@ -100,7 +100,7 @@ <li><strong>Uninstalled</strong> - The Assembly bundle is being uninstalled by calling the <code>Bundle.uninstall()</code> method. The <em>Assembly Manager</em> will (try to) uninstall all bundles listed in the <code>Assembly-Bundles</code> header.</li> <li><strong>Updated</strong> - The Assembly bundle will update all bundles installed previously according to the <code>Assembly-Bundles</code> header. If this header omits any bundle listed in the previous bundle version, the respective bundle is uninstalled from the system. If a bundle is already installed with the correct version, the installed bundle is not touched (It may though be uninstalled together with the Assembly Bundle if the Assembly Bundle is uninstalled).</li> </ul> -<h3>Bundles referenced by multiple Assembly Bundles</h3> +<h3><a href="#bundles-referenced-by-multiple-assembly-bundles" name="bundles-referenced-by-multiple-assembly-bundles">Bundles referenced by multiple Assembly Bundles</a></h3> <p>It is conceivable, that bundles are listed in the <code>Assembly-Bundles</code> header of more than one Assembly Bundle. If this is the case, the following collision resolution takes place:</p> <ul> <li>If the version of the bundle installed by the first Assembly bundle handled matches the version specification of any later Assembly Bundle, the installed bundle is not touched. Otherwise, if the later Assembly Bundle lists a version specification, which is acceptable for the first Assembly Bundle, the installed bundle is updated to the required version. If the version specifications may not be matched one way or the other, the later Assembly Bundle fails to install.</li> @@ -109,7 +109,7 @@ <li>Bundles not referred to by any Assembly Bundle are ignored by the <em>Assembly Manager</em>.</li> <li>Bundles installed through the <em>Assembly Manager</em> may be updated and/or uninstalled independently from their defining Assembly Bundle. If a bundle has been installed it will be reinstalled the next time the Assembly Bundle enters the <em>installed</em> state. If a bundle has been updated, it is not touched by the <em>Assembly Manager</em> as long as the updated version matches the version specification of the Assembly Bundle.</li> </ul> -<h3>Bundle Installation</h3> +<h3><a href="#bundle-installation" name="bundle-installation">Bundle Installation</a></h3> <p>When an Assembly is installed into the framework, the <em>Assembly Manager</em> checks to see whether the Assembly needs to be deployed. This is done by checking the bundles listed in the <code>Assembly-Bundles</code> header whether they are installed or not. All bundles not installed will be installed and started if requested so.</p> <p>The following BNF defines the syntax =Assembly-Bundles= header value:</p> <pre><code>Assembly-Bundles = Bundle { "," Bundle } . @@ -125,7 +125,7 @@ Parameter = ParameterName "=" ParameterValue . <li><strong>linked</strong> - Defines whether the bundle should be started and stopped together with the Assembly to which the bundle belongs. Default value is <code>true</code>.</li> </ul> <p>If resolving the bundles results in more bundles to be downloaded from the bundle repository to resolve the dependency, these bundles are always automatically started and assigned a startlevel which is smaller than the smallest startlevel of any of the bundles listed.</p> -<h3>Bundle Location</h3> +<h3><a href="#bundle-location" name="bundle-location">Bundle Location</a></h3> <p>Generally bundles to be installed with an Assembly Bundle are retrieved from an OSGi Bundle Repository. The <code>Assembly-BundleRepository</code> header may list additional URLs which will be temporarily used to resovle the bundles. Otherwise the system default bundle repositories will be used only.</p> <p>If a bundle is defined in the <code>Assembly-Bundles</code> header with an <code>entry</code> parameter, the respective entry is first looked for in the Assembly Bundle. If the entry exists, it is used as the bundle source to install. If no <code>entry</code> parameter is present for a declared bundle or the entry is missing, the OSGi Bundle Repository is used.</p> <p>Restrictions when packaging bundles with the Assembly:</p> @@ -138,8 +138,8 @@ Parameter = ParameterName "=" ParameterValue . <ul> <li><strong>Example</strong> - Assume the <code>Assembly-Bundles</code> header is set to <code>org.apache.sling.sample1;entry=path.jar,org.apache.sling.sample2</code>. The bundle <code>org.apache.sling.sample1</code> is then installed from the Assembly Bundle entry <code>path.jar</code>, while the bundle <code>org.apache.sling.sample2</code> is resolved in the OSGi Bundle Repository.</li> </ul> -<h2>Best Practices</h2> -<h3>Size of Bundles</h3> +<h2><a href="#best-practices" name="best-practices">Best Practices</a></h2> +<h3><a href="#size-of-bundles" name="size-of-bundles">Size of Bundles</a></h3> <p>There is no fixed formula to calculate the best size for a bundle: It all depends on the contents and the intentions of the bundle and its programmer. The following list provides some hints:</p> <ul> <li>For ease of development follow the idea of <em>One Bundle - One Project</em></li> @@ -147,7 +147,7 @@ Parameter = ParameterName "=" ParameterValue . <li>Do not mix and match everything into a bundle. Rather bundle things together which belong together, for example create separate bundles for a HTTP Client implementation and DB support classes</li> <li>Use similar heuristics to decide on the contents of a bundle as you would for the contents of a plain old JAR file.</li> </ul> -<h3>Nomen est Omen</h3> +<h3><a href="#nomen-est-omen" name="nomen-est-omen">Nomen est Omen</a></h3> <p>The symbolic name of a bundle should reflect its contents. A bundle should generally only contain a single subtree in the virtual package tree. The symbolic name of the bundle should be the root package contained within. For example, consider a bundle containing the packages <code>org.apache.sling.sample</code>, <code>org.apache.sling.sample.impl</code>, <code>org.apache.sling.more</code>. The bundle would the be named <code>org.apache.sling.sample</code>.</p></section></div></div> <div class="footer"> <div class="trademarkFooter"> http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/old-stuff/request-processing.html ---------------------------------------------------------------------- diff --git a/old-stuff/request-processing.html b/old-stuff/request-processing.html index d51452c..12b8fd5 100644 --- a/old-stuff/request-processing.html +++ b/old-stuff/request-processing.html @@ -76,7 +76,7 @@ 2008-02-13: this page is *out of sync* with the current codebase, needs to be reviewed and updated. </div> <p>One of the core problems towards understanding how Sling works is knowing how a Client Request is processed by Sling. This page describes the flow of processing requests inside Sling.</p> -<h2>Core Request Processing</h2> +<h2><a href="#core-request-processing" name="core-request-processing">Core Request Processing</a></h2> <p>The HTTP request enters Sling in the <code>org.apache.sling.core.ComponentRequestHandlerImpl.service(ServletRequest req, ServletResponse res)</code> method as the <code>ComponentRequestHandlerImpl</code> is registered as the Servlet handling HTTP requests. This method sets up the initial <code>ComponentRequest</code> and <code>ComponentResponse</code> objects and hands the request over to the first <code>ComponentFilterChain</code>. This first filter chain calls all <code>ComponentFilter</code> instances registered as request level filters. After processing all filters in the request level filter chain, the request is handed over to the second <code>ComponentFilterChain</code> which calls all <code>ComponentFilter</code> instances registered as component level filters. At the end of the second filter chain the <code>service</code> method of the actual <code>Component</code> to which the request resolved is called.</p> <p>As the component is now processing the request, it may decide to dispatch the request to some other content such as for example a paragraph system or navigation component. To do this, the component will call the <code>RequestDispatcher.include</code> method. If the request dispatcher dispatches to a <code>Content</code> object Sling will hand the dispatch request over to the component level filter chain, which at the end will call the <code>service</code> method for the <code>Content</code> object to dispatched to. This process may be repeated at the component's discretion only limited by processing resources such as available memory.</p> <p>As can be seen Sling itself is absed on the Component API <code>ComponentFilter</code> mechanism. As such Sling provides and uses the following filters in the Sling Core bundle:</p> @@ -97,7 +97,7 @@ <li>Resolve the component ID returned by the <code>Content.getComponentId()</code> method into a <code>Component</code> object. Of course it is an error, if the component ID cannot be mapped into a <code>Component</code> object.</li> </ol> <p>After resolving the <code>Component</code> object default component filter chain terminates and control is handed over to the <code>service</code> method of the <code>Component</code> object resolved in the last step. At the discretion of the component request dispatchers may now be acquired to render other <code>Content</code> objects. In this case the component level filter chain is simply kicked of again resulting in the <code>service</code> method of another <code>Component</code> being called. And so forth.</p> -<h2>Resolving Content</h2> +<h2><a href="#resolving-content" name="resolving-content">Resolving Content</a></h2> <p>As we have seen, the last step in the request level filter chain is the resolution of the request URL into a <code>Content</code> object. The URL Mapper Filter implementing this resolution uses an instance of the <code>org.apache.sling.content.ContentMapper</code> interface which is acquired by calling the <code>org.apache.sling.content.jcr.JcrContentManagerFactory</code> with the repository session acquired by the authentication filter.</p> <p>The URL Mapper filter then tries to apply fixed mappings from request URL to destination paths to support shortcut URLs. For example the root path <code>/</code> may be mapped into the default landing page at <code>/default/home</code>. The list of such mappings is configurable through the Configuration Admin Service.</p> <p>Next the URL Mapper tries to apply prefix matching patterns. A list of patterns is iterated checking whether the prefix applies and, if so, replacing the prefix with another prefix and trying to resolve the result. This functionality enables relocation of a subtree of the repository. For example, all requests whose prefix is <code>/here</code> might be remapped with the new prefix <code>/content/there</code>. The result of this remapping is then resolved.</p> @@ -107,10 +107,10 @@ <li><em>Vanity URLs</em> - Map the request URL according to the <code>Host</code> request header.</li> <li><em>Dynamic Mapping</em> - Add support for a set of variables in path and/or prefix mapping. For example, a prefix mapping may contain the string <code>/content/$\{lang}/$\{user</code>} resulting in resolving a prefix according to the language of the current locale and the name of the authenticated used.</li> </ul> -<h2>Registering Components</h2> +<h2><a href="#registering-components" name="registering-components">Registering Components</a></h2> <p>The last step of the component level filter chain is resolving the <code>Component</code> from the component ID of the <code>Content</code> object. Sling implements this resolution by making use of the OSGi service registry. That is, each component is to be registered as a service with the name <code>org.apache.sling.component.Component</code>. The <code>ComponentResolverFilter</code> is listening for these components and registers them internally in a map indexed by the IDs of the component as returned by the <code>Component.getId()</code> method.</p> <p>When a component has to be resolved, the component ID returned by the <code>Content</code> object is simply looked up in the component map. If found, that component is used. Otherwise a fall back algorithm is applied which is described on the [Default Content Mapping and Request Rendering]({{ refs.default-mapping-and-rendering.path }}) page.</p> -<h2>Reqistering Filters</h2> +<h2><a href="#reqistering-filters" name="reqistering-filters">Reqistering Filters</a></h2> <p>Just as <code>Component</code> instances used by Sling are expected to be registered as OSGi services, the <code>ComponentFilter</code>s to be used have to be registered as services under the name <code>org.apache.sling.component.ComponentFilter</code>. Sling picks up all registered component filters and adds them to the respective filter chains.</p> <p>Service properties set upon registration of the filter define the chain to which the filter belongs and the order in which the filters should be processed:</p> <table> @@ -131,7 +131,7 @@ </tr> </tbody> </table> -<h2>Content is a Java Object</h2> +<h2><a href="#content-is-a-java-object" name="content-is-a-java-object">Content is a Java Object</a></h2> <p>It is crucial to understand that <code>Content</code> is an interface and the request processor of Sling does not actually care, how the <code>Content</code> instance comes to live as long as the is such an object and there is a <code>Component</code> instance capable of servicing the <code>Content</code> object.</p> <p>By default Sling uses the <em>URL Mapper</em> to resolve the request URL into a <code>Content</code> object. When a <code>Component</code> is tasked with servicing a <code>Content</code> object it usually uses the <code>ComponentRequestDispatcher</code> to ask Sling to service another content object generally identified by a (relative or absolute) path to a JCR Repository Node from which the <code>Content</code> object is loaded.</p> <p>But instead of having Sling resolve a path into a <code>Content</code> object the component may just as well create a <code>Content</code> object and hand it over to the <code>ComponentRequestDispatcher</code> for service. Consider a request which is handled by a <code>PageComponent</code>. This component has to draw a navigation tree somewhere in the response. So the component could of course insist on having a <code>navigation</code> child node to dispatch rendering to as follows:</p> http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/old-stuff/run-modes-org-apache-sling-runmode.html ---------------------------------------------------------------------- diff --git a/old-stuff/run-modes-org-apache-sling-runmode.html b/old-stuff/run-modes-org-apache-sling-runmode.html index de0e395..681798e 100644 --- a/old-stuff/run-modes-org-apache-sling-runmode.html +++ b/old-stuff/run-modes-org-apache-sling-runmode.html @@ -78,20 +78,19 @@ by the new <a href="/documentation/bundles/sling-settings-org-apache-sling-setti Bundle. For backwards compatibility this bundle may still exist in your environment. New code should use the API of the new Sling Settings Bundle, though. </div> -<h1>Overview</h1> +<h1><a href="#overview" name="overview">Overview</a></h1> <p>Run modes are meant to define different sets of configuration parameters for various Sling instances.</p> <p>In a web publishing environment, for example, one could use run modes like <em>staging, production, dev, dmz</em> or combinations of such values.</p> <p>The <em>[org.apache.sling.runmode]({{ refs.http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/runmode.path }})</em> bundle provides a simple way of defining and querying a list of run modes.</p> -<h1>Installation</h1> +<h1><a href="#installation" name="installation">Installation</a></h1> <p>The run mode service is not present in the default Sling launchpad builds, to activate it install and start the <em>org.apache.sling.runmode</em> bundle.</p> -<h1>Configuration</h1> +<h1><a href="#configuration" name="configuration">Configuration</a></h1> <p>Run modes can only be configured using a system property, or via the <em>sling.properties</em> file.</p> <p>Using <em>-Dsling.run.modes=foo,bar</em> on the JVM command-line, for example, activates the <em>foo</em> and <em>bar</em> run modes. </p> <p>This command-line parameter takes precedence over a similar definition (*sling.run.modes=dev,staging*) that might be present in the <em>sling.properties</em> file found in the Sling home directory.</p> -<h1>Getting the current list of run modes</h1> +<h1><a href="#getting-the-current-list-of-run-modes" name="getting-the-current-list-of-run-modes">Getting the current list of run modes</a></h1> <p>The [RunMode service]({{ refs.http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/runmode/src/main/java/org/apache/sling/runmode/RunMode.java.path }}) provides the current list of run modes, examples:</p> -<pre><code>:::java -RunMode r = ...get from BundleContext... +<pre><code>:<!-- TODO syntax marker (::java) disabled -->RunMode r = ...get from BundleContext... String [] currentRunModes = r.getCurrentRunModes(); String [] expectedRunModes = { "foo", "wii" }; @@ -100,7 +99,7 @@ if(r.isActive(expectedRunModes)) { // is active } </code></pre> -<h1>See also</h1> +<h1><a href="#see-also" name="see-also">See also</a></h1> <p>The RunMode service is used by the [jcrinstall]({{ refs.jcr-installer-provider.path }}) services.</p></section></div></div> <div class="footer"> <div class="trademarkFooter"> http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/old-stuff/scriptengineintegration/groovy-support.html ---------------------------------------------------------------------- diff --git a/old-stuff/scriptengineintegration/groovy-support.html b/old-stuff/scriptengineintegration/groovy-support.html index ca2973b..f0fdcae 100644 --- a/old-stuff/scriptengineintegration/groovy-support.html +++ b/old-stuff/scriptengineintegration/groovy-support.html @@ -84,7 +84,7 @@ MIME Types application/x-groovy Names groovy, Groovy </code></pre> -<h2>Testing</h2> +<h2><a href="#testing" name="testing">Testing</a></h2> <p>To test create a simple Groovy script, for example</p> <pre><code>response.setContentType("text/plain"); response.setCharacterEncoding("UTF-8"); @@ -105,7 +105,7 @@ Hello World ! This is Groovy Speaking You requested Resource JcrNodeResource, type=nt:folder, path=/sample (yes, this is a GString) </code></pre> -<h2>References</h2> +<h2><a href="#references" name="references">References</a></h2> <ul> <li>[SLING-315]({{ refs.https://issues.apache.org/jira/browse/SLING-315.path }}) -- The initial Sling issue proposing the addition of a Groovy ScriptEngine to Sling.</li> <li>[Groovy Support in Apache Sling]({{ refs.http://markmail.org/message/7sqscr5y2mbk6jko.path }}) -- A short thread on turning the Groovy <code>groovy-all.jar</code> into an OSGi Bundle.</li> http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/old-stuff/scriptengineintegration/xslt-processing-pipeline.html ---------------------------------------------------------------------- diff --git a/old-stuff/scriptengineintegration/xslt-processing-pipeline.html b/old-stuff/scriptengineintegration/xslt-processing-pipeline.html index baf26f3..057d146 100644 --- a/old-stuff/scriptengineintegration/xslt-processing-pipeline.html +++ b/old-stuff/scriptengineintegration/xslt-processing-pipeline.html @@ -73,12 +73,12 @@ <div class="breadcrumbs"><a href="/ng/">Home</a> » <a href="/ng/old-stuff.html">Old Stuff</a> » <a href="/ng/old-stuff/scriptengineintegration.html">Integrating Scripting Languages</a> » </div> <h1> XSLT Processing Pipeline </h1><div class="row"><div class="small-12 columns"><section class="wrap"><p>In the <em>Apache Sling Scripting W3C XML Processing Support</em> bundle, Juanjo VÃ zquez has implemented XSLT processing support for Sling as another new scripting engine, based on the <a href="http://cocoon.apache.org/3.0/">Cocoon 3 pipeline engine</a>.</p> -<h2>Intro</h2> +<h2><a href="#intro" name="intro">Intro</a></h2> <p>An XML pipeline specifies a sequence of operations to be performed on zero or more XML documents. There are a number of advantages to using pipelines above all in terms of separation of concerns. On the other hand, we talk about XSLT processing if the operations in a pipeline are performed executing or applying XSLT stylesheets.</p> <p>XSLT processing support is implemented in Sling as an scripting engine bundle named <em>Apache Sling Scripting W3C XML Processing Support</em>. This bundle is based on the <a href="http://cocoon.apache.org/3.0/">Cocoon 3 pipeline engine</a> and uses the <a href="http://www.w3.org/TR/xproc/">W3C XProc language</a> in order to specify pipelines to be processed.</p> <p>For the time being, XProc is partially implemented and it is not clear that Sling must support all W3C recomendation yet. This could depend of concrete user requirements or use cases.</p> <p>The source code is found in the <a href="http://svn.apache.org/repos/asf/incubator/sling/trunk/contrib/scripting/xproc">contrib/scripting/xproc</a> module.</p> -<h2>How to Install</h2> +<h2><a href="#how-to-install" name="how-to-install">How to Install</a></h2> <p>Install the <code>org.apache.sling.scripting.xproc</code> bundle in order to work with XProc. You can achieve this either building it from <code>contrib/scripting/xproc</code> folder in the Sling trunk or by downloading it from the Apache Snapshot repository here: <a href="http://people.apache.org/repo/m2-snapshot-repository/org/apache/sling/org.apache.sling.scripting.xproc/2.0.0-incubator-SNAPSHOT/org.apache.sling.scripting.xproc-2.0.0-incubator-20090403.114403-1.jar">org.apache.sling.scripting.xproc-2.0.0-incubator-20090403.114403-1.jar</a>.</p> <p>To deploy the bundle go to the bundles page of Apache Felix Web Console (http://localhost:8888/system/console/bundles), select the bundle file to upload, check the Start check box and click Install or Update button.</p> <p>In order to check whether XProc scripting engine has been installed, go to the Script Engines page of the Apache Felix Web Console and see the entry for XProc there:</p> @@ -88,7 +88,7 @@ MIME Types application/xml Names XProc, xml processing, xml pipeline processor </code></pre> -<h2>How it works</h2> +<h2><a href="#how-it-works" name="how-it-works">How it works</a></h2> <p>As explained above, the bundle is able to perform a sequence of XSLT transforms on an XML document just as is expressed in a pipeline definition. A pipeline definition is a file with an xpl extension that follows the <a href="http://www.w3.org/TR/xproc/">W3C XProc grammar</a>. Only <code>p:xslt</code> steps are supported at the moment.</p> <p>For the XML input of pipeline, the processing uses a Cocoon generator named <code>SlingGenerator</code> that tries to resolve the requested resource as (in order of preference):</p> <ul> @@ -96,7 +96,7 @@ <li>a dynamically generated XML</li> <li>the underlying node's export document view</li> </ul> -<h2>Samples</h2> +<h2><a href="#samples" name="samples">Samples</a></h2> <p>Let's see some samples in order to understand the processing behaviour.</p> <ol> <li> @@ -108,8 +108,7 @@ $ curl -u admin:admin -F sling:resourceType=xproc -F title="some title" </li> <li> <p>Use WebDAV or curl to create a pipeline script at <code>/apps/xproc/xproc.xpl</code> :</p> - <pre><code>#!xml -<?xml version="1.0" encoding="UTF-8"?> + <pre><code><!-- TODO syntax marker (#!xml) disabled --><?xml version="1.0" encoding="UTF-8"?> <p:pipeline xmlns:p="http://www.w3.org/ns/xproc"> <p:xslt> @@ -130,8 +129,7 @@ $ curl -u admin:admin -F sling:resourceType=xproc -F title="some title" <li> <p>Store the XSLT transforms in the repository:</p> <p><strong><code>/apps/xproc/one.xsl</code></strong></p> - <pre><code>#!xml -<xsl:stylesheet version="1.0" + <pre><code><!-- TODO syntax marker (#!xml) disabled --><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> @@ -143,8 +141,7 @@ $ curl -u admin:admin -F sling:resourceType=xproc -F title="some title" </xsl:stylesheet> </code></pre> <p><strong><code>/apps/xproc/two.xsl</code></strong></p> - <pre><code>#!xml -<xsl:stylesheet version="1.0" + <pre><code><!-- TODO syntax marker (#!xml) disabled --><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> @@ -172,8 +169,7 @@ $ curl http://admin:admin@localhost:8888/foo.html </li> <li> <p>Now, store a static XML in the repository at <code>/foo.xml</code>:</p> - <pre><code>#!xml -<?xml version="1.0" encoding="UTF-8"?> + <pre><code><!-- TODO syntax marker (#!xml) disabled --><?xml version="1.0" encoding="UTF-8"?> <foo> <content> foo: static content @@ -201,8 +197,7 @@ $ curl http://admin:admin@localhost:8888/foo.html </li> <li> <p>Store a script in the repository at <code>/apps/xproc/xproc.xml.esp</code></p> - <pre><code>#!xml -<?xml version="1.0" encoding="UTF-8"?> + <pre><code><!-- TODO syntax marker (#!xml) disabled --><?xml version="1.0" encoding="UTF-8"?> <foo> <content> foo: dynamic content @@ -231,7 +226,7 @@ $ curl http://admin:admin@localhost:8888/foo.html <p>This time the pipeline's source has been a dinamically generated XML.</p> </li> </ol> -<h2>References</h2> +<h2><a href="#references" name="references">References</a></h2> <ul> <li><a href="http://cocoon.apache.org//3.0/">Cocoon 3 pipeline engine</a></li> <li><a href="http://www.w3.org/TR/xproc/">W3C XProc language</a></li> http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/old-stuff/servlet-resolution.html ---------------------------------------------------------------------- diff --git a/old-stuff/servlet-resolution.html b/old-stuff/servlet-resolution.html index d99cb56..9dd1d71 100644 --- a/old-stuff/servlet-resolution.html +++ b/old-stuff/servlet-resolution.html @@ -79,7 +79,7 @@ Please see the new [Servlets]({{ refs.servlets.path }}) page. </div> <p><!-- TODO reactivate TOC once JBake moves to flexmark-java --> </p> -<h2>Servlets are Resources</h2> +<h2><a href="#servlets-are-resources" name="servlets-are-resources">Servlets are Resources</a></h2> <p>As explained on the [Resources]({{ refs.resources.path }}) page, the Resource is the central data abstraction of Sling. In this contexts, Servlets are of course also povided as Resources. As such Servlets may be enumerated by iterating the Resource tree and Servlets may be retrieved through the <code>ResourceResolver</code>.</p> <p>To show a Servlet inside the Resource tree, the <code>sling/servlet-resolver</code> project provides a <code>ServletResourceProvider</code> implementing the <code>ResourceProvider</code> interface. For each Servlet registered as an OSGi service with one or more defined service reference properties a <code>ServletResourceProvider</code> instance is registered.</p> <p>The following service reference properties are defined for Servlets defined as OSGi services of type <code>javax.servlet.Servlet</code>:</p> @@ -124,7 +124,7 @@ Please see the new [Servlets]({{ refs.servlets.path }}) page. <li>Otherwise a Resource provider is registered for the Servlet for each permutation resource types, selectors, extensions and methods.</li> </ol> <p>Each path to be used for registration -- either from the <code>sling.servlet.paths</code> property or constructed from the other <code>sling.servlet.*</code> properties -- must be absolute. Any relative path is made absolute by prefixing it with a root path. This prefix may be set with the <code>sling.servlet.prefix</code> service registration property. If this property is not set, the first entry in the <code>ResourceResolver</code> search path for the <code>ResourceResolver.getResource(String)</code> method is used as the prefix. If this entry cannot be derived, a simpe slash -- <code>/</code> -- is used as the prefix.</p> -<h3>Example: Registration by Path</h3> +<h3><a href="#example-registration-by-path" name="example-registration-by-path">Example: Registration by Path</a></h3> <pre><code>sling.servlet.paths = [ "/libs/sling/sample/html", "/libs/sling/sample/txt" ] sling.servlet.resourceTypes = [ "sling/unused" ] sling.servlet.selectors = [ "img" ] @@ -136,7 +136,7 @@ sling.servlet.extensions = [ "html", "txt", "json" <li><code>/libs/sling/sample/txt</code></li> </ul> <p>The registration properties <code>sling.servlet.resourceTypes</code>, <code>sling.servlet.selectors</code> and <code>sling.servlet.extensions</code> are ignored because the <code>sling.servlet.paths</code> property is set.</p> -<h3>Example: Registration by Resource Type etc.</h3> +<h3><a href="#example-registration-by-resource-type-etc-" name="example-registration-by-resource-type-etc-">Example: Registration by Resource Type etc.</a></h3> <pre><code>sling.servlet.resourceTypes = [ "sling/unused" ] sling.servlet.selectors = [ "img", "tab" ] sling.servlet.extensions = [ "html", "txt", "json" ] @@ -151,12 +151,12 @@ sling.servlet.extensions = [ "html", "txt", "json" <li><code>*prefix*/sling/unused/tab/json</code></li> </ul> <p>As explained the script is registered for each permutation of the resource types, selectors and extension. See above For an explanation of how <code>*prefix*</code> is defined.</p> -<h2>Scripts are Servlets</h2> +<h2><a href="#scripts-are-servlets" name="scripts-are-servlets">Scripts are Servlets</a></h2> <p>The Sling API defines a <code>SlingScript</code> interface which is used to represent (executable) scripts inside of Sling. This interface is implemented in the <code>scripting/resolver</code> bundle in the <code>DefaultSlingScript</code> class which also implements the <code>javax.servlet.Servlet</code>.</p> <p>To further simplify the access to scripts from the Resource tree, the <code>scripting/resolver</code> bundle registers an <code>AdapterFactory</code> to adapt Resources to Scripts and Servlets. In fact the adapter factory returns instances of the <code>DefaultSlingScript</code> class for both Scripts and Servlets.</p> <p>This functionality is used by the <code>ServletResolver.resolveServlet</code> implementation in the <code>sling/servlet-resolver</code> bundle: This implementation just looks up any Resource in the resource tree according its lookup algorithm (see below). The first matching Resource adapting to a <code>javax.servlet.Servlet</code> is used for processing the resource.</p> <p>So from the perspective of the Servlet resolver, scripts and servlets are handled exactly the same.</p> -<h2>Resolution Process</h2> +<h2><a href="#resolution-process" name="resolution-process">Resolution Process</a></h2> <p>The Servlet Resolution Process four elements of a <code>SlingHttpServletRequest</code>:</p> <ol> <li>The <em>resource type</em> as retrieved through <code>request.getResource().getResourceType()</code>. Because the resource type may be a node type such as <em>nt:file</em>, the resource type is mangled into a path by replacing any colons contained to forward slashs. Also, any backslashes contained are replaced to forward slashes. This should give a relative path. Of course a resource type may also be set to an absolute path. See below.</li> @@ -208,7 +208,7 @@ Servlet findScriptFor(path) { // extension, such as .js, .jsp, etc. } </code></pre> -<h2>Default Servlet(s)</h2> +<h2><a href="#default-servlet-s-" name="default-servlet-s-">Default Servlet(s)</a></h2> <p>As explained in the Resolution Process section above, a default Servlet is selected if no servlet for the current resource type can be found. To make the provisioning of a default Servlet as versatile as provisioning per resource type Servlets (or scripts), the default Servlet is selected with just a special resource type <code>sling/servlet/default</code>.</p> <p>The actual Servlet or Script called as the default Servlet is resolved exactly the same way as for any resource type. That is, also for the default Servlet selection, the request selectors and extension or method are considered. Also, the Servlet may be a Servlet registered as an OSGi service and provided through a Servlet Resource provider or it may be a Script stored in the repository or provided by the bundle.</p> <p>Finally, if not even a registered default Servlet may be resolved for the request, because none has been registered, the <code>sling/servlet-resolve</code> bundle provides a fall back <code>DefaultServlet</code> with the following functionality:</p> @@ -217,13 +217,13 @@ Servlet findScriptFor(path) { <li>Otherwise if the object has an OCM mapping, the properties of the mapped object are printed.</li> <li>Otherwise just the path of the Resource is printed.</li> </ul> -<h2>Error Handler Servlet(s)</h2> +<h2><a href="#error-handler-servlet-s-" name="error-handler-servlet-s-">Error Handler Servlet(s)</a></h2> <p>The <code>sling/servlet-resolver</code> project also provides an implementation of the Sling Core <code>ErrorHandler</code> interface, which applies the same Servlet resolution process as used for normal request processing. Error handler Servlets and Scripts are looked up with the predefined resource <code>sling/servlet/errorhandler</code> and an error specific name:</p> <ul> <li><em>HTTP Status Code Handling</em>: To handle HTTP status code as used by the <code>HttpServletResponse.sendError</code> methods, status code is used as the Servlet name. For example to provide a handler for status code 404 (NOT*FOUND), you could create a script <code>prefix/sling/servlet/errorhandler/404.esp</code> or for a status code 500 (INTERNAL*SERVER_ERRROR), you might want to register a Servlet at <code>prefix/sling/servlet/errorhandler/500</code>.</li> <li><em>Throwable Handling</em>: To handle uncaught <code>Throwables</code> the simple name of the <code>Throwable</code> class is used as the Servlet name. Similarly to the Java <code>try-catch</code> clauses the class hierarchy is supported. That is to handle an uncaught <code>FileNotFoundException</code>, the names <code>FileNotFoundException</code>, <code>IOException</code>, <code>Exception</code>, <code>Throwable</code> are checked for a Servlet and the first one found is then used. Again, the Serlvet may be a Servlet registered as an OSGi service or may be a plain script stored in the JCR repository or provided through some custom Resource provider.</li> </ul> -<h2>Integration tests</h2> +<h2><a href="#integration-tests" name="integration-tests">Integration tests</a></h2> <p>A set of simple example servlets is available in the [launchpad/test-services module]({{ refs.http://svn.apache.org/repos/asf/incubator/sling/trunk/launchpad/test-services.path }}). </p> <p>Integration tests in the [launchpad/testing module]({{ refs.http://svn.apache.org/repos/asf/incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/resolution.path }}) verify that these examples are correct.</p> <p>Contributions to these tests and examples are welcome, of course!</p></section></div></div>
