Saturday, July 11, 2015

Jersey : Handle invalid json requests by overriding exception handling

In enterprise applications we usually encounter situations where we get invalid request for our RESTful webservice. The processing fails but client doesn't know the exact cause of problem. In the below article I explain how can we handle invalid request by overriding the exception handling of a Jersey based RESTful webservice.

Saturday, April 18, 2015

Parse json into multiple java pojos using Jackson annotations

Jackson is a suite of data-processing tools for Java (and JVM platform), including the flagship streaming JSON parser / generator library, matching data-binding library (POJOs to and from JSON). In real world programming we will encounter complex cases of JSON to POJO conversion. Here, is one such case where we want to parse a single JSON into multiple java POJOs.

Sunday, April 12, 2015

Generating java files from XSD using Maven and JAXB

Java Architecture for XML Binding (JAXB) provides a fast and convenient way to bind XML schemas and Java representations, making it easy for Java developers to incorporate XML data and processing functions in Java applications. As part of this process, JAXB provides methods for unmarshalling (reading) XML instance documents into Java content trees, and then marshalling (writing) Java content trees back into XML instance documents. JAXB also provides a way to generate XML schema from Java objects and vice-versa.
Here we are going to talk about generating java objects from your XSD (XML Schema Definition).

Note : If you are using only Ant for your build, the flow is explained here.

Sunday, March 22, 2015

Configure testing of your web application using Jenkins

Purpose : To demonstrate the automation of testing of a web application after each build.
Assumptions : 1. The application build is already configured on Jenkins. 
                         2. We have a service method that runs all test cases.

I have a web application which is scheduled to build via Jenkins. Now I need to test the application after each build. The following steps can be used to configure test cases :