Status code override with ContainerResponseFilter and name binding

The correct status code to return on successful resource creation is 201 Created. In this case CXF will set the response status code to 200 OK. There are many ways to override this value. One possibility is to return an instance of the Response class, so you can set headers, status and body manually. But this implies a change in the service API. We will resort to another possibility that leaves the API unchanged.

Read More

Unit tests with EasyMock

Let’s write unit tests for the REST service implementation. We want to test this component isolatedly. One manner to achieve that is to use a mocking framework, such as EasyMock, Mockito or PowerMock.

Read More

Persistence layer with Spring Data JPA, EclipseLink and Derby

Let’s split data and logic layers. The data layer will be configured using Spring Data JPA which provides generic DAO implementation, EclipseLink as a reference implementation for the Java Persistence API and an embedded database Derby. I said configured, because there is almost no implementation.

Read More

Integration tests with JMeter

JMeter is a tool that can be used to perform integration or last tests on REST services. We will configure the same test scenario as with the proxy-based CXF client.

Read More

Logging with Spring AOP

Aspect Oriented Programming allows you to implement transversal functionalities such as logging, monitoring or transaction handling without having to modifiy existing code.

Read More

REST Client Browser Add-ons

You can find REST Client Add-ons for most of the browsers. They propose a user friendly interface to generate, send REST requests and analyze the response. These are useful for punctual manual testing.

Read More

Up and running!

This blog will be about web services. It will focus on technical aspects and try to present short and elegant examples.

Read More