diff --git a/CHANGELOG.md b/CHANGELOG.md
index 151c28d9..d5ac35f2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,21 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+---
+## Version 3.0.13, 4/28/2023
+
+### Added
+
+Added optional static content HTTP-GET request filter in rest.yaml
+
+### Removed
+
+N/A
+
+### Changed
+
+Updated guava to version 33.1.0-jre
+
---
## Version 3.0.12, 4/24/2023
diff --git a/benchmark/benchmark-client/pom.xml b/benchmark/benchmark-client/pom.xml
index 99668939..404e4530 100644
--- a/benchmark/benchmark-client/pom.xml
+++ b/benchmark/benchmark-client/pom.xml
@@ -7,7 +7,7 @@
benchmark-client
jar
- 3.0.12
+ 3.0.13
Benchmark client
@@ -45,7 +45,7 @@
org.platformlambda
platform-core
- 3.0.12
+ 3.0.13
diff --git a/benchmark/benchmark-server/pom.xml b/benchmark/benchmark-server/pom.xml
index a5735957..64188b82 100644
--- a/benchmark/benchmark-server/pom.xml
+++ b/benchmark/benchmark-server/pom.xml
@@ -7,7 +7,7 @@
benchmark-server
jar
- 3.0.12
+ 3.0.13
Benchmark server
@@ -45,7 +45,7 @@
org.platformlambda
platform-core
- 3.0.12
+ 3.0.13
diff --git a/connectors/adapters/hazelcast/hazelcast-connector/pom.xml b/connectors/adapters/hazelcast/hazelcast-connector/pom.xml
index 75f5b569..a0a2f4e0 100644
--- a/connectors/adapters/hazelcast/hazelcast-connector/pom.xml
+++ b/connectors/adapters/hazelcast/hazelcast-connector/pom.xml
@@ -7,7 +7,7 @@
hazelcast-connector
jar
- 3.0.12
+ 3.0.13
Cloud connector for Hazelcast cluster
@@ -42,7 +42,7 @@
org.platformlambda
cloud-connector
- 3.0.12
+ 3.0.13
diff --git a/connectors/adapters/hazelcast/hazelcast-presence/pom.xml b/connectors/adapters/hazelcast/hazelcast-presence/pom.xml
index dd4030f4..5d5fcba1 100644
--- a/connectors/adapters/hazelcast/hazelcast-presence/pom.xml
+++ b/connectors/adapters/hazelcast/hazelcast-presence/pom.xml
@@ -5,7 +5,7 @@
org.platformlambda
hazelcast-presence
jar
- 3.0.12
+ 3.0.13
Presence monitor for Hazelcast
@@ -40,13 +40,13 @@
org.platformlambda
service-monitor
- 3.0.12
+ 3.0.13
org.platformlambda
hazelcast-connector
- 3.0.12
+ 3.0.13
diff --git a/connectors/adapters/kafka/kafka-connector/pom.xml b/connectors/adapters/kafka/kafka-connector/pom.xml
index ef79a779..82df432a 100644
--- a/connectors/adapters/kafka/kafka-connector/pom.xml
+++ b/connectors/adapters/kafka/kafka-connector/pom.xml
@@ -7,7 +7,7 @@
kafka-connector
jar
- 3.0.12
+ 3.0.13
Cloud connector for Kafka cluster
@@ -42,7 +42,7 @@
org.platformlambda
cloud-connector
- 3.0.12
+ 3.0.13
diff --git a/connectors/adapters/kafka/kafka-presence/pom.xml b/connectors/adapters/kafka/kafka-presence/pom.xml
index e23886a6..87dbbde8 100644
--- a/connectors/adapters/kafka/kafka-presence/pom.xml
+++ b/connectors/adapters/kafka/kafka-presence/pom.xml
@@ -5,7 +5,7 @@
org.platformlambda
kafka-presence
jar
- 3.0.12
+ 3.0.13
Presence monitor for Kafka
@@ -40,13 +40,13 @@
org.platformlambda
service-monitor
- 3.0.12
+ 3.0.13
org.platformlambda
kafka-connector
- 3.0.12
+ 3.0.13
diff --git a/connectors/adapters/kafka/kafka-standalone/pom.xml b/connectors/adapters/kafka/kafka-standalone/pom.xml
index d6c612d8..35443039 100644
--- a/connectors/adapters/kafka/kafka-standalone/pom.xml
+++ b/connectors/adapters/kafka/kafka-standalone/pom.xml
@@ -7,7 +7,7 @@
kafka-standalone
jar
- 3.0.12
+ 3.0.13
Standalone kafka system for dev
@@ -42,7 +42,7 @@
org.platformlambda
platform-core
- 3.0.12
+ 3.0.13
diff --git a/connectors/core/cloud-connector/pom.xml b/connectors/core/cloud-connector/pom.xml
index 70f4eff6..cfb34296 100644
--- a/connectors/core/cloud-connector/pom.xml
+++ b/connectors/core/cloud-connector/pom.xml
@@ -7,7 +7,7 @@
cloud-connector
jar
- 3.0.12
+ 3.0.13
Cloud connector module
@@ -42,7 +42,7 @@
org.platformlambda
platform-core
- 3.0.12
+ 3.0.13
diff --git a/connectors/core/service-monitor/pom.xml b/connectors/core/service-monitor/pom.xml
index 192522b1..729d0858 100644
--- a/connectors/core/service-monitor/pom.xml
+++ b/connectors/core/service-monitor/pom.xml
@@ -5,7 +5,7 @@
org.platformlambda
service-monitor
jar
- 3.0.12
+ 3.0.13
Presence monitor module
@@ -40,13 +40,13 @@
org.platformlambda
cloud-connector
- 3.0.12
+ 3.0.13
org.platformlambda
platform-core
- 3.0.12
+ 3.0.13
diff --git a/examples/lambda-example/pom.xml b/examples/lambda-example/pom.xml
index 2dc4704b..e0895c1e 100644
--- a/examples/lambda-example/pom.xml
+++ b/examples/lambda-example/pom.xml
@@ -7,7 +7,7 @@
lambda-example
jar
- 3.0.12
+ 3.0.13
Composable application example
@@ -42,7 +42,7 @@
org.platformlambda
platform-core
- 3.0.12
+ 3.0.13
diff --git a/examples/rest-spring-2-example/pom.xml b/examples/rest-spring-2-example/pom.xml
index 89f7e37c..d79dd1b1 100644
--- a/examples/rest-spring-2-example/pom.xml
+++ b/examples/rest-spring-2-example/pom.xml
@@ -5,7 +5,7 @@
com.accenture
rest-spring-2-example
- 3.0.12
+ 3.0.13
jar
Spring Boot 2 example
@@ -42,7 +42,7 @@
org.platformlambda
rest-spring-2
- 3.0.12
+ 3.0.13
diff --git a/examples/rest-spring-3-example/pom.xml b/examples/rest-spring-3-example/pom.xml
index e2a724fe..674f7181 100644
--- a/examples/rest-spring-3-example/pom.xml
+++ b/examples/rest-spring-3-example/pom.xml
@@ -5,7 +5,7 @@
com.accenture
rest-spring-3-example
- 3.0.12
+ 3.0.13
jar
Spring Boot 3 example
@@ -41,7 +41,7 @@
org.platformlambda
rest-spring-3
- 3.0.12
+ 3.0.13
diff --git a/extensions/api-playground/pom.xml b/extensions/api-playground/pom.xml
index ca884cbd..c047cb3e 100644
--- a/extensions/api-playground/pom.xml
+++ b/extensions/api-playground/pom.xml
@@ -7,7 +7,7 @@
api-playground
jar
- 3.0.12
+ 3.0.13
API playground using OpenAPI
@@ -43,7 +43,7 @@
org.platformlambda
rest-spring-2
- 3.0.12
+ 3.0.13
diff --git a/extensions/simple-scheduler/pom.xml b/extensions/simple-scheduler/pom.xml
index 80471dfb..2bf920b2 100644
--- a/extensions/simple-scheduler/pom.xml
+++ b/extensions/simple-scheduler/pom.xml
@@ -7,7 +7,7 @@
simple-scheduler
jar
- 3.0.12
+ 3.0.13
Simple Scheduler
@@ -43,7 +43,7 @@
org.platformlambda
rest-spring-2
- 3.0.12
+ 3.0.13
diff --git a/guides/CHAPTER-3.md b/guides/CHAPTER-3.md
index c13e1db8..62181928 100644
--- a/guides/CHAPTER-3.md
+++ b/guides/CHAPTER-3.md
@@ -212,6 +212,64 @@ headers:
- "Pragma: no-cache"
- "Expires: Thu, 01 Jan 1970 00:00:00 GMT"
```
+
+## Static content
+
+Static content (HTML/CSS/JS bundle), if any, can be placed in the "resources/public" folder in your
+application project root. It is because the default value for the "static.html.folder" parameter
+in the application configuration is "classpath:/resources/public". If you want to place your
+static content elsewhere, you may adjust this parameter. You may point it to the local file system
+such as "file:/tmp/html".
+
+For security reason, you may add the following configuration in the rest.yaml.
+The following example is shown in the unit test section of the platform-core library module.
+
+```yaml
+#
+# Optional HTTP GET request filter for static HTML/CSS/JS files
+# -------------------------------------------------------------
+#
+# This provides a programmatic way to protect certain static content.
+#
+# The filter can be used to inspect HTTP path, headers and parameters.
+# The typical use case is to check cookies and perform browser redirection
+# for SSO login. Another use case is to selectively add security HTTP
+# response headers such as cache control and X-Frame-Options.
+#
+# In the following example, the filter applies to all static content
+# HTTP-GET requests except those with the file extension ".css".
+# You can implement a function with the service route "http.request.filter".
+# The input to the function will be an AsyncHttpRequest object.
+#
+static-content-filter:
+ path: ["/"]
+ excludes: [".css"]
+ service: "http.request.filter"
+```
+
+The sample request filter function is available in the platform-core project like this:
+
+```java
+@PreLoad(route="http.request.filter", instances=100)
+public class GetRequestFilter implements LambdaFunction {
+
+ @Override
+ public Object handleEvent(Map headers, Object input, int instance) throws Exception {
+ return new EventEnvelope().setHeader("x-filter", "demo");
+ }
+}
+```
+
+In the above http.request.filter, it adds a HTTP response header "X-Filter" for the unit test
+to validate.
+
+If you set status code in the return EventEnvelope to 302 and add a header "Location", the system
+will redirect the browser to the given URL in the location header. Please be careful to avoid
+HTTP redirection loop.
+
+Similarly, you can throw exception and the HTTP request will be rejected with the given status
+code and error message accordingly.
+
| Chapter-2 | Home | Chapter-4 |
diff --git a/pom.xml b/pom.xml
index 0c81dc3e..56425086 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.accenture.mercury
parent-mercury
pom
- 3.0.12
+ 3.0.13
Parent Mercury
diff --git a/system/platform-core/pom.xml b/system/platform-core/pom.xml
index f9d4e4ca..e5f74591 100644
--- a/system/platform-core/pom.xml
+++ b/system/platform-core/pom.xml
@@ -6,7 +6,7 @@
org.platformlambda
platform-core
jar
- 3.0.12
+ 3.0.13
Mercury platform-core module
@@ -85,7 +85,7 @@
com.google.guava
guava
- 33.0.0-jre
+ 33.1.0-jre
diff --git a/system/platform-core/src/main/java/org/platformlambda/automation/config/RoutingEntry.java b/system/platform-core/src/main/java/org/platformlambda/automation/config/RoutingEntry.java
index b01535b2..4626dc55 100644
--- a/system/platform-core/src/main/java/org/platformlambda/automation/config/RoutingEntry.java
+++ b/system/platform-core/src/main/java/org/platformlambda/automation/config/RoutingEntry.java
@@ -18,10 +18,7 @@
package org.platformlambda.automation.config;
-import org.platformlambda.automation.models.AssignedRoute;
-import org.platformlambda.automation.models.CorsInfo;
-import org.platformlambda.automation.models.HeaderInfo;
-import org.platformlambda.automation.models.RouteInfo;
+import org.platformlambda.automation.models.*;
import org.platformlambda.core.system.AppStarter;
import org.platformlambda.core.util.ConfigReader;
import org.platformlambda.core.util.Utility;
@@ -77,6 +74,7 @@ public class RoutingEntry {
private static final Map requestHeaderInfo = new HashMap<>();
private static final Map responseHeaderInfo = new HashMap<>();
private static final List urlPaths = new ArrayList<>();
+ private static SimpleHttpFilter requestFilter;
private static final RoutingEntry instance = new RoutingEntry();
private RoutingEntry() {
@@ -87,6 +85,10 @@ public static RoutingEntry getInstance() {
return instance;
}
+ public SimpleHttpFilter getRequestFilter() {
+ return requestFilter;
+ }
+
public AssignedRoute getRouteInfo(String method, String url) {
Utility util = Utility.getInstance();
StringBuilder sb = new StringBuilder();
@@ -192,8 +194,39 @@ private boolean matchRoute(List urlParts, List segments, boolean
return true;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings(value="unchecked")
+ private SimpleHttpFilter getFilter(ConfigReader config) {
+ Object path = config.get("static-content-filter.path");
+ Object exclusion = config.get("static-content-filter.excludes");
+ String service = config.getProperty("static-content-filter.service");
+ if (path instanceof List && exclusion instanceof List && service != null && !service.isEmpty()) {
+ if (Utility.getInstance().validServiceName(service)) {
+ log.info("Static content HTTP-GET filter installed: {} -> {}, excludes extensions {}",
+ path, service, exclusion);
+ List pathList = new ArrayList<>();
+ List excludeExtensions = new ArrayList<>();
+ List