jersey 2.0 - How to get the actual values from OutboundJaxrsResponse in java? -
in restclient returns below response jersey service. outboundjaxrsresponse{status=200, reason=ok, hasentity=true, closed=false, buffered=false}
the above 1 returns list. how can list , how validate each record id? if id not available in database need store missing id. how handle this?
below code;
public response list() throws exception { response response = null; restclient client = service.getclient(); try { response = client.invokeservicegetforarray(servicetype, "/test/name", null, null); jsonarray responselst = (jsonarray) response.readentity(jsonarraybuilder.class); system.out.println("response array list :: " + responselst); } catch (exception e) { return response.status(status.internal_server_error).entity(e.getlocalizedmessage()).build(); } return response; }
above code snippet returns below response : outboundjaxrsresponse{status=200, reason=ok, hasentity=true, closed=false, buffered=false} trying read response using below code : jsonarray responselst = (jsonarray) response.readentity(jsonarraybuilder.class); throwing below exception. java.lang.illegalstateexception: method not supported on outbound message. @ org.glassfish.jersey.message.internal.outboundjaxrsresponse.readentity(outboundjaxrsresponse.java:145)
thanks in advance,
Comments
Post a Comment