Skip to content

pdudits/hypermedia-java21

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Hypermedia Web Stack With Java 21 String Templates

This repository accompanies talk "Elementary Hypermedia Web-Stack with Java 21 String Templates". It demonstrates no-dependency web server which serves an example shopping cart by means of plain HTML forms, Unpoly and HTMX.

Server implementation

Server uses Java built-in HTTP Server jdk.httpserver, server with virtual threads. A small adapter is written around its API, in order to implement things like path matching, query string and handling of form POSTS. That code is located in package io.zeromagic.fullstack.server.

Requests are served by implementing Server.Handler. Handler would go matching attributes of a request such as request path segments and methods and return a response.

Domain

Data for shopping cart are implemented as few Java records in io.zeromagic.fullstack.domain.

Templating framework

The framework defines a StringTemplate.Processor which fills the response buffer with constituent parts of template, recursively processing nested String templates. The code is defined in io.zeromagic.fullstack.templates.Framework.

Based on this framework we define general layout of the page in class Page. The individual pages then extend and override the slots represented by (abstract) methods.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published