In JAX-RS, we can map exceptions to a Response. This will be useful in hiding the exceptions from the client of JAX-RS web services. Below is an example showing how to map exceptions to appropriate responses. First we need to implement ExceptionMapper interface as shown below. Here we want to map NullPointer exception to Internal…… Continue reading Mapping exceptions to Response in JAX-RS
Month: April 2018
Configuring the Jsonb instance
From the previous posts we can see that an instance of Jsonb is used for serialization/deserialization of java objects to/from json format. We can configure the Jsonb instance by creating an instance of JsonbConfig. By default jsonb implementation provider must support the following properties to be configured. jsonb.to.json.formatted – java.lang.Boolean Controls whether or not the…… Continue reading Configuring the Jsonb instance