FreshMarker Variable Scope Revised

The blog posts on the FreshMarker template engine pursue several goals. On the one hand, the posts should of course entertain their readers. On the other hand, they also serve me to focus and document my ideas on various aspects of the implementation. One very interesting topic in this post is the management of variables within the Template Engine.

FreshMarker 1.9.0 available

I am pleased to announce the release of FreshMarker 1.9.0. The version includes some new features and improvements. The library is now available on Maven Central. And for all those who like a cheat sheet, there is now one available here.

Masking Sensitive Information in FreshMarker

Working as a software developer allows me to constantly look into new subject areas and gather inspiration for my projects. Looking at a document with redacted information was the impetus for two new FreshMarker built-ins mask and mask_full.

REST endpoints with filters

Java Bibliotheken

This article is a slightly updated English version of the article “REST Endpunkte mit Filtern”.

In addition to sorting and pagination, filtering is a fairly common action on REST endpoints. In contrast to the first two, however, there is no adequate solution for filtering in the Spring Boot framework. With little effort, however, this can be elegantly implemented with the Spring Boot tools.

Of bridges and tunnels – agile system creation

Tunnel constructions are classic waterfall projects in which extensive planning is carried out and then construction can be completed without major changes. There are geological surprises from time to time, but a tunnel plan is, quite literally, set in stone.

Optimistic Locking mit dem ETag Header

Bild von Kerstin Riemer https://pixabay.com/de/users/kriemer-932379/

Wenn mehr als ein Beteiligter beim Speichern von Daten involviert ist, kann es zu ungewollten Überschreibungen kommen. Um solche Probleme zu umgehen, existieren drei Vorgehensweisen. Pessimistic Locking, Optimistic Locking und Ignore It!

Padding in FreshMarker

A wonderful achievement of agile software development is, that new features are implemented when they are needed and not before. It took a long time for the built-ins left_pad and right_pad for padding text to be implemented, but now they are finally here.

Checking Types with Build-Ins in FreshMarker

The FreshMarker Template Engine works with an interpolation system that only takes the type of a variable into account at evaluation time. This approach makes the use of variables in FreshMarker very flexible, but occasionally leads to runtime errors. These can be avoided if the type of a variable can be checked beforehand.

FreshMarker Extension API

The FreshMarker Plug-In Mechanism was one of the first features to be realized for the template engine. The idea behind it was simple. With a proper plug-in mechanism, a new feature can be easily realized and integrated and if it fits the core functionality, it stays in FreshMarker. Otherwise it becomes an independent plug-in. This is how FreshMarker File, FreshMarker Money and FreshMarker Random were created. It also created the internal FreshMarker support for Version, Locale, Year, MonthYear, MonthDay, Duration, Period and some other classes.

Compress Whitespace in FreshMarker

Whitespace in a template engine like FreshMarker’s is fundamentally different from the rest of the characters outside of it’s language constructs. A considerable amount of whitespace and line breaks are only used to ensure that the structure of the template remains comprehensible to the author.

The Knuth Plass Algorithm

Some algorithms are real classics and yet nobody really knows them. Day in, day out, everyone is happy about the beautiful wrapping of their text in the word processor, but why does the text actually look so beautiful spread across the lines?

FreshMarker – compile it! (4)

A further step on the way to static templates is the automation of their creation. A Maven plugin can be used to convert the FreshMarker template sources into Java source code. Although there are now more modern build tools, Maven is still used in many projects. The first task of the Maven plugin should be the validation of template sources.

Clean Unit Tests with ArgumentsAggregator

Java Bibliotheken

In previous articles on JUnit 5, various mechanisms were presented with which the JUnit tests could be made clearer. In this article, the ArgumentsAggregator is presented as an additional helpful mechanism.