Can I get normal pojo as json object in RESTful-jersey?

If you are using servlets, set the POJOMappingFeature to true in the web. Xml file, and POJO conversion will be done automatically.

If you are using servlets, set the POJOMappingFeature to true in the web. Xml file, and POJO conversion will be done automatically. Jersey com.sun.jersey.spi.container.servlet.

ServletContainer com.sun.jersey.config.property. Packages my.package. Name com.sun.jersey.api.json.

POJOMappingFeature true.

Thanks for the reply – Shamsudeen Nov 8 at 15:39.

You may check the following example for guidance: download.java.net/maven/2/com/sun/jersey... Also read the docs to get more knowledge: jersey.java.net/nonav/documentation/late....

The default registered JSON serialization provider works using the same annotations as JAXB (which itself handles XML serialization). This is usually an advantage as it means that you only need to put one set of annotations on, and don't have to write any direct serialization code yourself of course. But it is possible to do more of the serialization work yourself.

@Produces("application/json") @Provider public class FlightsWriter implements MessageBodyWriter { public boolean isWriteable(Class type, Type genericType, Annotation annotations, MediaType mediaType) { return type instanceof Flights; // Simplest possible } public long getSize(Flights flights, Class type, Type genericType, Annotation annotations, MediaType mediaType) { return -1; // Or real size if you can work it out! } public void writeTo(Flights flights, Class type, Type genericType, Annotation annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { // Put your code to write the JSON here... } } Be aware, it's a lot of work which is why most people use the built-in engine and add JAXB annotations.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions