Category: java

SSLHandshakeException: unsupported certificate

When: loading client certificates from a custom keystoreReason: multiple certificates for the same domain but different purposes, e.g. one certificate handles email authentication, the other authenticates the user against a web serverSolution: either fix the buggy code that selects the wrong certificate from the keystore or make sure only one certificate per domain is in … Continue reading SSLHandshakeException: unsupported certificate

Spring MVC REST controller says 406 when emails are part URL path

You've got this Spring @RestController and mapped a URL that contains an email as part of the URL path. You cunningly worked around the dot truncation issue [1] and you are ready to roll. And suddenly, on some URLs, Spring will return a 406 [2] which says that the browser requested a certain content type … Continue reading Spring MVC REST controller says 406 when emails are part URL path

Reactive programming for Java, revisited

Abstract Rewritten on 15 January 2015   In this post I'll talk about the problems callbacks introduce into the readability of asynchronous Java programs. I'll also discuss an implementation of method pointers for Java which aids the transformation of a callback-style program into a linear program flow, greatly increasing readability while still being a 100% … Continue reading Reactive programming for Java, revisited

Reddit as an OAuth provider for a Java backend

OAuth (2) and Java work well together, there are plenty of libraries available which handle the general case and the more specific peculiarities of the various OAuth providers. Despite solid implementations like my favourite Spring Social [1] framework¬† the state of OAuth is at best fragmented. Not only because Spring Social is not as well … Continue reading Reddit as an OAuth provider for a Java backend

A better eq() when matching method arguments with Mockito

I learned late of Mockito [1], even so more I love it. Walking a little farther away from the basics, a frequent needs presents itself to match method parameters (either when specifying or verifying behaviour) based on properties of complex objects which do not implement the java equals contract.Such an example would be verifying that … Continue reading A better eq() when matching method arguments with Mockito