the method of my jax-rs application:
@GET
@Produces (MediaType.APPLICATION_JSON)
public List getDocumentList(@HeaderParam(\"Range\") String head
You're missing a library as described here:
Here is the solution
This means that you are missing a JSON library in your classpath. Jackson is one I’m using so adding this to your pom.xml will help:
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.10.1</version>
</dependency>
The snippet below should do the trick.
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getDocumentList(@HeaderParam("Range") String headerRange) {
int[] range = getRangeFromHeader(headerRange);
return Response.ok(
new GenericEntity<List<Document>>( (List<Document>)facade.listByRange(range))
)
.header("Content-Range", getContentRangeStr(range)).build();
}
The anonymous GenericEntity
subclass is required to supply the correct type information (otherwise erased by the compiler) for the writer.
-- EDIT
The reason why your code worked using org.jboss.resteasy.resteasy-jackson-provider
but not with org.jboss.resteasy.resteasy-jettison-provider
resides on the fundamental difference between the two providers: