This collection showcases various RESTHeart plugins, each serving a specific purpose. Below is a brief overview of each plugin:
- Example Configuration Files: Provides a collection of sample configuration files for RESTHeart.
- Greeter Service: Implements two basic Java REST Web services returning Text and JSON payloads. Demonstrates usage of
ByteArrayServiceandJsonServiceinterfaces. - CSV Interceptor: Illustrates how to snoop and modify requests with Interceptors.
- User Signup: Implement user signup processes. It's a quite complex example that utilizes interceptors, services, JSON schema validation, and security permissions.
- MongoDB serverStatus Service: Offers access to MongoDB's
serverStatussystem call and demonstrates how to inject theMongoClientin a plugin. - Slack Notifier: An asynchronous interceptor that posts messages to a Slack channel when a document is created in a specified collection.
- Random String Service: Provides random strings. Showcases deployment of services with external dependencies.
- Protocol Buffer Contacts: Interceptors adjusting request and response formats to and from MongoService for Protocol Buffer payloads.
- Freemarker HTML page: Generates HTML Web pages using Apache Freemarker.
- Custom Logging Field: Details adding custom fields to logs via MDC Context.
- Form Header: A Service with a bespoke
Requestto manage Form POST requests. - Instance name: This interceptor adds a custom
X-Restheart-Instanceheader to all responses processed by any service in RESTHeart. It serves as a practical demonstration of using theWildcardInterceptorinterface and illustrates how to inject theConfigurationobject into a plugin. - X-Headers-to-qparams: offers a convenient way to convert specific request headers into query parameters, showing how to dynamically modify the request before it reaches the designated handling Service.
- X-Powered-By Remover: Response interceptors that remove the
X-Powered-By: restheart.orgheader from service and proxied resource responses, showing how to dynamically modify the response after it has been generated by the designated handling Service.
- Kotlin Greeter Service: A basic service implemented using Kotlin.
- JavaScript Plugins: A compilation of example JavaScript plugins.
- Node Plugin: A JavaScript plugin for RESTHeart, running on GraalVM's Node.js implementation.
- Credit Card Hider: A JavaScript Interceptor that obfuscates credit card numbers in responses. Demonstrates response transformation in existing Services.
To work with these examples, the following are required:
-
Java 25: Install it using sdkman:
$ sdk install java 25-tem
-
Docker: Necessary for running RESTHeart and MongoDB.
-
HTTPie: A command-line HTTP client for testing, available at httpie.io/cli.
Note: The examples use Maven, but it's accessible through the included Maven wrapper (mvnw), so a separate installation is not required.