2013 August

22 Aug: Implementing a role hierarchy in Spring Security (Java config style)

From http://static.springsource.org/spring-security/site/docs/3.1.x/reference/authz-arch.html: It is a common requirement that a particular role in an application should automatically “include” other roles. For example, in an application which has the concept of an “admin” and a “user” role, you may want an admin to be able to do everything a normal user can. To achieve this, you can either make sure that all admin users are also assigned the “user” role. Alternatively, you can modify every access constraint which requires…

19 Aug: How to map unknown JSON properties with Jackson?

For a current project, I need to map a JSON object that have some known fields, and some “dynamics” fields. I don’t want to ignore these fields, just to get them in a map inside my bean. After digging for 20 minutes, I finally found the right annotations to use: @JsonAnyGetter and @JsonAnySetter. @JsonAnySetter is a simple marker that can be used to define a two-argument method (first argument name of property, second value to set), to…

19 Aug: A simple Tcp Client/Server using Reactor

Reactor is a foundation for asynchronous applications on the JVM. It provides abstractions for Java, Groovy and other JVM languages to make building event and data-driven applications easier. It’s also really fast. On modest hardware, it’s possible to process around 15,000,000 events per second with the fastest non-blockingDispatcher. Other dispatchers are available to provide the developer with a range of choices from thread-pool style, long-running task execution to non-blocking, high-volume task dispatching. Since the first milestone of…