FreshMarker and ⊻, ¬, ≠, ≤, ≥, ∨, ∧

Sometimes a new feature also needs to be a bit of fun. When updating the FreshMarker Grammar, I noticed that the operators lt, gt, gte and lte were still present. These are variants of the usual <, >, <= and >= operators and are reminiscent of the opcodes of a long-forgotten era when assembler languages still roamed the steppes of programming. Since FreshMarker was given its Unicode capabilities by CongoCC, the question arose as to why not allow ≠ and other operator characters in the template.

FreshMarker und OWASP

It will come as no surprise that FreshMarker, like all other template engines, must take precautions against template injection. Template injection is a security vulnerability that occurs when an application handles templates insecurely. Templates are prefabricated files or strings with placeholders that are replaced by data from users or other sources. Similar to FreeMarker, FreshMarker also has an escape mechanism that detects special characters in the interpolations using a harmless variant. If the standard mechanism is not enough, OWASP can help out.

FreshMarker Performance (1)

FreshMarker started as an academic project. The main aim was to show how a template engine can be created. At some point, however, the question arose as to how fast the template engine actually is. To be honest, it has been slow so far. But first things first.

FreshMarker Sorted Hash Lists

I really like it when I can add new features to FreshMarker, especially if they are easy to implement and integrate elegantly into the overall system.

FreshMarker Template Engine 1.0.0

I am proud to announce the release of FreshMarker 1.0.0! Having started as a small example for blog posts two years ago, FreshMarker has evolved into a robust and versatile framework designed to meet diverse templating needs.

FreshMarker Import Directive

FreshMarker is an embedded Java template engine that focusses on extensibility and simplicity. For this reason, every implementation of an extension is associated with weighing up its pros and cons. For a long time, the import directive therefore remained an unrealised feature.

FreshMarker – Custom String Types

Some additions to a framework are so trivial that they don’t really deserve their own article. On the other hand, as a developer, you may ask yourself why this addition has taken so long. For unknown data types, FreshMarker uses the interpretation of the class as a Java Bean by default. This is a good solution for many POJO, DTO and Entity classes, but in some cases the class should be used as a primitive FreshMarker type.

Trivial Pursuit – API MarkDown (2)

Fasst drei Jahre nach dem ersten Beitrag zum eigenen API MarktDown ergibt sich ein zweiter Beitrag zum Thema. Bei der Durchsicht der eigenen Projekte fiel auf, dass in dem Projekt rest-markdown-plugin noch immer FreeMarker als Template-Engine verwendet wurde. Die erste Ad-Hoc Umstellung der Template-Engine auf FreshMarker scheiterte jedoch kläglich.

Mehr Zeit mit FreshMarker (2)

Wer sich an die Aufzählung der unterstützen temporalen Datentypen erinnert, wird diverse neue Klassen wie Instant, ZonedDateTime oder OffsetDateTime vermissen. In diesem Beitrag werden zwei von ihnen in die Gruppe der unterstützen Datentypen aufgenommen. Bevor die Implementierung dieser Erweiterung vorgestellt wird, ein paar Worte zu den temporalen Java Standardklassen.

Mehr Zeit mit FreshMarker

Einer der Gründe für die Entwicklung der FreshMarker Bibliothek, war die fehlende Unterstützung der Java Time API in FreeMarker. Daher existierte schon in der ersten Implementierung neben der Unterstützung für java.util.Date, java.sql.Date und java.sql.Time auch eine Unterstützung für java.time.LocalDateTime, java.time.LocalDate und java.time.LocalTime. In diesem Beitrag wird die Formatierung für alle temporalen Typen verbessert. Bislang beherrschte FreshMarker nur die Standarddarstellung und eine Computer Audience Darstellung.