i have made one web service now i want to encrypt that json data using s/mime rest easy encryption at server side
@Path("/All")
@GET
@Produces("application/json")
@GZIP
public EnvelopedOutput getAllOpenMeetings(@QueryParam("batchsize")
int batchSize, @QueryParam("offset")
int offset, @Context
HttpServletRequest req) {
String ipAddress = req.getRemoteAddr();
EnvelopedOutput output=null;
CustomerBean bean=null;
try {
bean=new CustomerBean();
bean.setDesc("abc");
bean.setName("xyz");
X509V3Generator generator=new X509V3Generator();
X509Certificate certificate=generator.get();
output = new EnvelopedOutput(bean, MediaType.APPLICATION_XML_TYPE);
output.setCertificate(certificate);
} catch (Exception ex) {
String result = "Error 500 - Internal Server Error";
System.out.println("exception=="+ex.getMessage());
// throw new WebApplicationException(Response.status(500).entity(result).build());
}
return output;
}
but give eception:org.codehaus.jackson.map.JsonMappingException: Direct self-reference leading to cycle
but when i change @Produces("application/json")=@Produces("text/plain") then its not return the encrypted form its return simply object of EnvelopedOutput.
please help me
thank you