I am using Spark.staticFileLocation to serve multiple static HTML / CSS/ JS etc files and folders in resource/public and want to replace content within these files:
staticFileLocation("/public");
Spark.after((request, response) -> {
String body = response.body();
body.replace("stringA", "stringB");
response.body(body);
});
But response.body()
is empty (null), even though the files get rendered fine.
I know that I can achieve that with a templating engine, but this creates a huge overhead and compelixity for the simple replacement I want to do. Does anyone have a better suggestion ? Thanks a lot !
/edit: Latest spark version 2.7.2 does not even evaluate the Spark.after() block for static files.