Everything is a Resource has been created by Felix Meschberger (Dec 22, 2007).

Content:

Introducing the Sling Paradigm: Everything is a Resource

Status: DRAFT
Created: 22. December 2007
Author: fmeschbe

1 Current State

Currently Sling uses resources, servlets and scripts as follows:

  • The Resource interface is mainly used to abstract JCR Node instances
  • The ServletResolver uses an internal registration of servlets registered as OSGi services with the interface javax.servlet.Servlet and selects the servlet based on the resource type of the Resource of the request only.
  • The ScriptResolver uses the ResourceResolver to find request handling scripts based on the resource type of the Resource of the request, the request selector string and the request method or request extension.
  • Request processing filters are based on OSGi services registered with the interface name javax.servlet.Filter
  • Error handling is implemented in the ServletResolver implementation using the same mechanism to find a servlet (or script) based on the response status code or the caught Throwable as the pseudo request method name and using a different default error handling servlet.

This mechanism works rather good, but there are currently enhancement requests, which may not easily be implemented with the current concepts:

  • Allow scripting of request processing filters. Implementing this requires special filter wrappers, which may select filter scripts.
  • Enhance servlet selection to include the same parameters as script resolution, namely the request selector string and the request method or request extension. Implementing this would require replicating much of the code of the current ScriptResolver implementation.

2 Enter the Sling Paradigm

To overcome the limitations we introduce the Sling paradigm

Everything is a Resource

The Sling paradigm brings the paradigm of Java Content Repository API (JCR) Everything is Content to Sling

Reply via email to