Reading HttpServletRequest Multiple Times in Spring 1. Introduction In this tutorial, we’ll learn how to read the body from the HttpServletRequest multiple times using Spring. HttpServletRequest is an interface which exposes getInputStream()  method to read the body. By default, the data from this InputStream can be read only once. 2. Maven… Continue Reading spring-reading-httpservletrequest-multiple-times

Map Serialization and Deserialization with Jackson 1. Overview In this article, we’ll look at serialization and deserialization of Java maps using Jackson. We’ll illustrate how to serialize and deserialize Map<String, String>, Map<Object, String>, and Map<Object, Object> to and from JSON-formatted Strings. 2. Maven Configuration [source,xml,gutter:,true] <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.9.4</version> </dependency>… Continue Reading jackson-map

Filtering Jackson JSON Output Based on Spring Security Role 1. Overview In this quick tutorial, we’ll show how to filter JSON serialization output depending on a user role defined in Spring Security. 2. Why Do We Need To Filter? Let’s consider a simple yet common use case where we have… Continue Reading spring-security-role-filter-json

Spring JSON-P with Jackson 1. Overview If you’ve been developing anything on the web, you’re aware of the same-origin policy constraint browsers have when dealing with AJAX requests. The simple overview of the constraint is that any request originating from a different domain, schema or port, will not be permitted.… Continue Reading spring-jackson-jsonp