the method of my jax-rs application:
@GET
@Produces (MediaType.APPLICATION_JSON)
public List <Document> getDocumentList(@HeaderParam("Range") String headerRange) {
int [] range = getRangeFromHeader(headerRange);
return facade.listByRange(range);
}
working properly. But If modifications to the:
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getDocumentList(@HeaderParam("Range") String headerRange) {
int[] range = getRangeFromHeader(headerRange);
return Response.ok(
facade.listByRange(range))
.header("Content-Range", getContentRangeStr(range)).build();
}
I receive an error
...NoMessageBodyWriterFoundFailure: Could not find MessageBodyWriter for response
object of type: java.util.ArrayList of media type: application/json...
Server Jboss 7.1.1
Please tell me what's wrong.
PS.sorry for my bad English.
The snippet below should do the trick.
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 withorg.jboss.resteasy.resteasy-jettison-provider
resides on the fundamental difference between the two providers:You're missing a library as described here:
Here is the solution