Skip to content

apache/sling-org-apache-sling-servlets-resolver

Apache Sling

Build Status Test Status Coverage Sonarcloud Status JavaDoc Maven Central servlets License

Apache Sling Servlets Resolver

This module is part of the Apache Sling project.

This OSGi bundle implements Sling's servlet and script resolution services:

  • org.apache.sling.api.servlets.ServletResolver via SlingServletResolver
  • org.apache.sling.api.scripting.SlingScriptResolver via SlingScriptResolverImpl (deprecated API bridge)
  • org.apache.sling.api.servlets.JakartaErrorHandler for error handling using Sling's resolution algorithm

See the servlets and scripts documentation for resolution behavior.

Highlights

  • Supports both javax.servlet (4.x) and jakarta.servlet (6.1) APIs
  • Resolves scripts and servlets across resource-type hierarchies with selector/extension/method matching
  • Mounts OSGi servlet services into the resource tree through dedicated resource providers
  • Tracks bundled scripts contributed through OSGi capabilities (sling.servlet)
  • Maintains servlet/script resolution caches with JMX inspection and cache management support
  • Includes resolver diagnostics through a Felix Web Console plugin
  • Supports optional servlet/script hiding via IgnoredServletResourcePredicate
  • Provides a configurable bundled-script health check (BundledScriptTrackerHC)

Build and test

This module requires Java 17 and uses Maven.

  • Build bundle (skip tests): mvn clean package -DskipTests
  • Run unit tests: mvn test
  • Run full verification (unit + integration tests): mvn verify
  • Run integration tests only: mvn verify -Dsurefire.skip=true
  • Run verification without integration tests: mvn verify -DskipITs
  • Run SpotBugs check: mvn spotbugs:check
  • Run a single unit test class: mvn test -Dtest=ResourceCollectorTest
  • Run a single integration test class: mvn verify -Dit.test=ServletSelectionIT

Project structure

src/main/java/org/apache/sling/servlets/resolver/
  api/
    IgnoredServletResourcePredicate.java
  jmx/
    SlingServletResolverCacheMBean.java
  internal/
    SlingServletResolver.java
    SlingScriptResolverImpl.java
    ResolverConfig.java
    helper/      (resource and location collectors)
    resolution/  (resolver cache implementation)
    resource/    (servlet mounting/resource providers)
    bundle/      (bundled script tracking and servlet wrapper support)
    defaults/    (default and error handler servlets)
    console/     (Web Console diagnostics)

src/test/java/org/apache/sling/servlets/resolver/
  internal/      (unit tests)
  internal/resourcehiding/  (unit tests for hiding predicate behavior)
  it/            (Pax Exam integration tests)
  it/resourcehiding/  (integration tests for hidden servlet fallback behavior)

About

Apache Sling Servlets Resolver

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages