Sto utilizzando client jersey per inviare un file a un URI REST che restituisce la risposta come json. Il mio requisito è di leggere la risposta così com'è (json) su una stringa.lettura risposta JSON come stringa utilizzando client jersey
Ecco la parte di codice che pubblica i dati sul servizio web.
final ClientResponse clientResp = resource.type(
MediaType.MULTIPART_FORM_DATA_TYPE).
accept(MediaType.APPLICATION_JSON).
post(ClientResponse.class, inputData);
System.out.println("Response from news Rest Resource : " + clientResp.getEntity(String.class)); // This doesnt work.Displays nothing.
clientResp.getLength() è 281 byte che è la dimensione della risposta, ma clientResp.getEntity (String.class) restituisce nulla.
Qualche idea su cosa potrebbe non essere corretto qui?
In questo momento il metodo Jersey corretto è readEntity (String.class), invece di getEntity (String.class). –