In this article I’m going to present a solution for hosting a single page application using HTML5 / client-side routing in a Java web application. This is not easily supported out of the box, so I thought it would be helpful to write a dedicated article that presents a ready-to-use solution.

Traditionally routing is done server-side. The server receives a HTTP request, determines which page of the application is requested and then renders that page itself.


In this article I’m going to present a simple configuration solution for small to medium-sized applications running in Tomcat. It uses only the configuration mechanism that Java and Tomcat provide out-of-the-box, requires minimal code and supports multiple installations.

Motivation

Most applications need some sort of environment-specific configuration. Depending on the environment (Test, Prod, Customer-specific…) you usually have different databases, use different API endpoints or different accounts for accessing a resource. …


Conditional compilation is not a very common topic for JavaScript. Most JavaScript code runs on the web, where the same piece of code has to work on a range of different browser platforms. For conditional code execution we usually check values that are determined at runtime (Browser API, Web Requests).

However there are cases where it can be beneficial to use conditional compilation instead.

Traditionally it is a technique that is often used is when compiling native executables for different platforms or architectures. In this scenario you want the executable to only include instructions that are available on that platform.

Sascha Ißbrücker

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store