JSON example with Jersey + Jackson
This article shows how to return a JSON response in the Jersey application, using Jackson 2.x. Tested with: Jersey 3.0.2, Grizzly 3 HTTP Server, Jackson 2.12.2 , Java 11, Maven,…
XML example with RESTEasy + JAXB
RESTEasy, is required JAXB to support XML file. To use JAXB in RESTEasy, you need to include the “resteasy-jaxb-provider.jar” dependency. In this tutorial, we show you how to create an…
Illegal to inject a message body into a singleton into public org.codehaus.jackson.jaxrs.JacksonJsonProvider
Using Jackson as JSON provider in RESTEasy. With RESTEasy auto scanning enabled. When starting up, it hits following errors and failed to start up any of the RESTEasy services: Illegal…
JSON example with RESTEasy + JAXB + Jettison
RESTEasy uses Jettison JSON library to map JAXB annotation object to and from JSON. In this tutorial, we show you how to convert an JAXB annotated object into JSON format…
JSON example with RESTEasy + Jackson
Many like Jackson JSON processor, and it supported in RESTEasy. In this tutorial, we show you how to convert an object to JSON format and return it back to the…
Download excel file from JAX-RS
In JAX-RS, for excel file, annotate the method with @Produces("application/vnd.ms-excel") : 1 - Put @Produces(“application/vnd.ms-excel”) on service method , 2 - Set “Content-Disposition” in Response header to prompt a download…
Download pdf file from JAX-RS
In JAX-RS, for pdf file, annotate the method with @Produces("application/pdf") : 1- Put @Produces(“application/pdf”) on service method, 2 - Set “Content-Disposition” in Response header to prompt a download box.
Download image file from JAX-RS
In JAX-RS, for user to download an image file, annotate the method with @Produces("image/image-type") : 1 - Put @Produces(“image/png”) on service method, for “png” image, 2 - Set “Content-Disposition” in…
Download text file from JAX-RS
In this tutorial, we show you two ways to get HTTP request header in JAX-RS : 1 - Inject directly with @HeaderParam, 2 - Pragmatically via @Context
Get HTTP header in JAX-RS
In this tutorial, we show you two ways to get HTTP request header in JAX-RS : 1 - Inject directly with @HeaderParam , 2 - Pragmatically via @Context