Handling different subresources with JAX-RS subresource locatorJava, REST ·
In this article I won’t explain what a resource or sub resource is. There are several pages that explain perfectly well its meaning. For example, you can check Oracle tutorial or Jersey documentation. I will focus on implementing a RESTful service with a JAX-RS sub resource locator. This locator will decide at runtime what...
Retrieving method annotations with Spring AnnotationUtilsSpring ·
The JDK provides us with several lookup methods that allow us to retrieve annotations from a class, method, field or added to method parameters. The Spring AnnotationUtils is a general utility class for annotations which extends the basic functionalities. In this post I will explain the main features of this class, focusing on retrieving annotations from a method.
Unit testing with PowerMockJava, Test ·
In this article I will implement unit testing with PowerMock library. This framework is more powerful than other libraries and allows you to mock static methods, private methods and change field properties among other things. I will use the Mockito extension but it also supports EasyMock.
If you use Maven, you can add the following...
Communication in Spring Webflow 2Spring, Spring Webflow ·
This article tries to complement the reference documentation with examples on variables, scopes and flows in Spring Webflow 2. It shows different ways to share data between controllers and views that form a flow. The article is divided into the following sections:
- Setting flow variables
- Setting attribute values
- Using additional scopes
- Communication with sub flows
- Communication with other flows ...
Centralize validation and exception handling with @ControllerAdviceSpring, Spring MVC ·
The ControllerAdvice annotation introduced by Spring 3.2 allows us to handle several functionalities in a way that can be shared by all controllers (through its handler methods, annotated with @RequestMapping). This annotation is mainly used to define the following methods:
- @ExceptionHandler: Handles exceptions thrown by handler...