I am implementing jersey restful web service to get application/json mime type from the java bean classes. Given below is the resource class code
@GET
@Produces({"application/json"})
public synchronized Flights getFlightList() {
return myFlights;
}
Here if the return object (Flight) converts to json object only when the Flight encoding with jaxb. For normal POJO classes, it is returning nothing instead Http error ”500” is coming.
Can you please tell me if it is possible to send normal java bean object in json format? If yes, then please let me know how to get it?
If you are using servlets, set the POJOMappingFeature to true in the web.xml file, and POJO conversion will be done automatically.