Jersey
Blog posts for the tag #Jersey
09-Nov-2017
A custom exception mapper and writer for a RESTful JAX-RS Jersey serviceI've written quite a few articles about Jersey already ranging from filter and interceptor execution order to a custom message body reader implementation. This article delves deeper into Jersey and looks at how to gracefully handle exceptions by using an exception mapper and entity writer to convert a caught exception to output from your service.
26-Oct-2017
Writing a custom MessageBodyReader to process POST body data with JerseyJersey makes it really easy to customise how your RESTful service accepts input and how it produces output. I've written previously about how, with a few lines of code it's possible to use Jackson to convert your POJOs to JSON when returning data from your service. This article looks at the other end of the lifecycle - the input, specifically how a JAX-RS service can process a POST message body and create a POJO as input to a Resource method parameter. In other words - how do you implement a custom message body reader?
19-Oct-2017
Jersey JAX-RS filters and interceptors execution order for a simple GET requestI've written about Jersey on a number of occasions in the past. During my time working with Jersey I always found that there weren't good resources available that showed the data flow and invocation order of filters and interceptors while processing a request. This is a going to be a multi-part series of articles examining what Jersey does with various request/response scenarios, most importantly it will include diagrams! This part will start with a very simple GET request.
10-May-2017
Postman reporting Unexpected 'N' error in response bodyI've been using Postman to test some RESTful services and came across a strange error in the body of the response from a service - "Unexpected 'N'". I knew for a fact that the service was not returning this error so something else must have been going haywire.
22-Mar-2017
Using Jersey 2.x as a shared library on WebLogic 12.1.2WebLogic 12.1.2 may not be listed on Oracle Technology Network Downloads page but it is still being used. When it comes to RESTful services on WebLogic, 12.1.2 supports Jersey 1.13 so if you're looking to make use of Jersey 2.x features, there's some extra work to be done. With 12.1.3 you can go straight for Jersey 2.x but that's outside the scope of this article.
14-Mar-2017
Injecting a ContainerRequestContext into a Jersey entity provider classI was implementing a custom entity provider in a Jersey REST service when I came across an error during deployment: "java.lang.IllegalStateException: Not inside a request scope." That struck me as a little odd since I was trying to inject a ContainerRequestContext into a MessageBodyWriter, which should have been within request scope. After some research and this Jersey issue I found a solution.