locrian code

Tech notes and opinions

Using Jetty form-based authentication with Dropwizard

Dropwizard is a rather nice Java REST framework. Although mainly designed for web services, it can also be used for MVC-style web applications, with dropwizard-views which supports both FreeMarker and Mustache templates on the front end.

What’s missing out of the box is form-based authentication. The embedded Jetty web server does contain this functionality — but there are a number of steps involved in getting it wired up.

New Beginnings

So I decided it was finally time to resurrect this blog and bring it into the 21st century. It’s now powered by Hugo, a static site generator written in Go. I promise there will be a few more posts soon!

Closure Exposure

These days people are becoming more aware that you can write real object oriented code in Javascript. Even though the language doesn’t support classes with private members directly, you can achieve the same thing quite easily using closures.

Static classes and unit testing

If you unit test your code (and I hope you do), you’ll quickly discover that you need to mock out parts of the system. This is much easier if you design with testability in mind from the start of the project. In particular, as you’ll see, you need to be very careful about where you use static classes.