docs: update AGENTS.md and README.md with clarifications and new entries (#38)

Co-authored-by: Maia <maia@noreply>
2 files changed
tree: 366348ff590e348987a509ae45f8e1da8c3e65cb
  1. developer-tests/
  2. src/
  3. .asf.yaml
  4. .git-blame-ignore-revs
  5. .gitignore
  6. .sling-module.json
  7. AGENTS.md
  8. bnd.bnd
  9. CLAUDE.md
  10. CODE_OF_CONDUCT.md
  11. CONTRIBUTING.md
  12. Jenkinsfile
  13. LICENSE
  14. pom.xml
  15. Protocols.md
  16. README.md
README.md

Apache Sling

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

Apache Sling Default POST Servlets

Provides the default POST servlet bundle for Apache Sling.

This module is part of the Apache Sling project. You can read more about this module on our documentation site.

Overview

The bundle provides the default SlingPostServlet and built-in POST operations for Sling content changes, including:

  • create and modify
  • delete
  • copy and move
  • import
  • restore
  • checkin/checkout and versioning helpers
  • file upload (regular, streamed, and chunked)

The implementation is Jakarta Servlet-first and uses Sling Jakarta APIs. Legacy javax.servlet SPI integration remains available through wrapper adapters under impl/wrapper.

Extension points

Custom behavior can be provided via OSGi services such as:

  • JakartaPostOperation
  • SlingJakartaPostProcessor
  • JakartaNodeNameGenerator
  • JakartaPostResponseCreator

Build and test

Java 17 is required.

  • Full build: mvn clean install
  • Build without tests: mvn clean install -DskipTests
  • Unit tests: mvn test
  • Integration tests (Failsafe, including ModifyOperationIT): mvn verify
  • Single unit test class: mvn test -Dtest=HtmlResponseTest
  • Single integration test class: mvn verify -Dit.test=ModifyOperationIT

Manual upload smoke tests

For manual file-upload protocol checks against a running Sling instance on localhost:8080 (admin:admin), use:

sh developer-tests/testFileUploads.sh <testfile>

The script uploads using regular, streamed, and chunked streamed protocols, then downloads and compares content. See developer-tests/README.md and Protocols.md for protocol and script details.

Repository layout

pom.xml                        Maven build descriptor (packaging: jar)
bnd.bnd                        OSGi bundle instructions and embedded resources
Protocols.md                   Protocol notes for POST and upload behavior
src/
  main/java/org/apache/sling/servlets/post/
    *.java                     Public Jakarta-first API/SPI (+ legacy compatibility APIs)
    exceptions/                Persistence-related exceptions
    impl/                      Internal servlet and operation implementations
      operations/              Built-in POST operations
      helper/                  Internal helpers (upload, property handling, naming, chunking)
      wrapper/                 Jakarta <-> javax bridging adapters
  main/resources/
    SLING-INF/nodetypes/chunk.cnd   Chunked upload node type definitions
    org/apache/sling/servlets/post/ HTML response templates
    system/sling.js            Bundled JS resource
  test/java/                   Unit and integration tests
developer-tests/               Manual developer test scripts

Notes

  • OSGi metadata is generated with bnd (bnd-maven-plugin), with API baseline checks via bnd-baseline-maven-plugin.
  • The build shades selected classes from jackrabbit-jcr-commons and sling-jcr-contentparser into internal impl packages.
  • JCR (javax.jcr.*) and org.apache.sling.jcr.contentloader imports are configured as dynamic for runtime flexibility.
  • The bundle depends on jakarta.servlet-api as primary API and keeps javax.servlet-api plus org.apache.felix.http.wrappers for compatibility adapters.