Hi,
How can we have an HTML format output for the JSON and XML
Content-Type, for example in the class below I have made annotation
@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON}) but the
result output should contatin the Content-type and output format is in html
format , do any one have an idea
thanks
@Path("/luckynumbers")
@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
@Consumes({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
public class CcmdServiceRESTFull{
@GET
@Path("/getSum/{arg0}/{arg1}")
public Response getSum(@PathParam(value="arg0") int arg0
,@PathParam(value="arg1") int arg1,@Context HttpHeaders header) {
MediaType mediaType = header.getAcceptableMediaTypes().get(0);
String mediaStringType =
mediaType.getType()+"/"+mediaType.getSubtype();
//return
Response.status(Response.Status.OK).type(mediaStringType).entity(Integer.toString(arg1+arg0)).build();
ResponseWrapper responseWrapper = new ResponseWrapper();
responseWrapper.setTheResponse(Integer.toString(arg1+arg0));
return responseWrapper.sendResponse(mediaStringType);
}
}
--
View this message in context:
http://cxf.547215.n5.nabble.com/add-HTML-output-to-JSON-and-XML-tp4427885p4427885.html
Sent from the cxf-user mailing list archive at Nabble.com.