Category Archives: Jersey

Execution flow Filters & Interceptors in JAX-RS (Jersey & example)

Request response flow in client server paradigm We have shown the request response mechanism of service and client in Fig 1. Request initiated from Client Request data written to transport layer (written to network) Request reaches the Service Request data read from transport channel Service resource process the requests and generate the response Response sent back… Read More »

Override JsonInclude properties using ObjectMapper ContextResolver (Jersey)

Given the model annotated with @JsonInclude annotation. Sometime the model objects are in third party jars or libraries, so we can not change the include types specified in @JsonInclude annotations. We would to like customize the behavior using ObjectMapper in contextResolver by configuring the Serialization It is kind of global serialization for application. Program –… Read More »

RESTFul web service serialize non null & date field (jersey /objectmapper /contextresolver)

Given a user defined object or POJO having null fields (i.e. some fields are null). When we are serializing object the null values gets serialized. Moreover, suppose object contains the date field also, then date field will be serialized as timestamp value. We will use ObjectMapper (jackson feature) to customize the serialization process. In this post we will… Read More »

Multipart file upload client for RESTFul web service (java/ jersey/example)

Multipart file upload client is capable of uploading different kind of files to RESTFul web service using Jersey framework. 1. What is objective of Multipart file Upload client using jersey ? File upload client using “multipart/mixed” mime type. We have upload the following file formats to be RESTFul web service JPG JSON PDF zip We have discussed… Read More »

Jersey ExceptionMapper (user defined exceptions) in RESTful web Service

In this post, we will discuss Jersey (RESTFul Service) Exception mapper example for user defined or custom exceptions. We have already discussed, usage of standard exceptions in Example of ExceptionMapper – RESTFul web Service. We will create couple of user defined exceptions MyNullPointerException (extending NullPointerException). MyArithmeticException (extending ArithmeticException). We will define following exceptionmappers to catch application & user defined exceptions. ApplicationExceptionMapper… Read More »

Jersey ExceptionMapper (standard exceptions) in RESTful web Service (java/ example)

In this post we are going to discuss about the exception mapper implementation using jersey framework. Exception handling is need for our applications. The jersey ExceptionMapper provide cross cutting concern, where in we can able to catch all application exception at one place. we do not need to handle the exceptions in each and every function. In this post, we will throw and catch following exceptions.

Page 1 of 212