openvidu-java-client: improve exception handling and Entity consumption

pull/707/head
pabloFuente 2022-03-10 20:50:29 +01:00
parent 85b6496ba0
commit af6a1a3693
3 changed files with 110 additions and 100 deletions

View File

@ -203,14 +203,10 @@ public class OpenVidu {
request.setHeader(HttpHeaders.CONTENT_TYPE, "application/json"); request.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");
request.setEntity(params); request.setEntity(params);
HttpResponse response; HttpResponse response = null;
try { try {
response = this.httpClient.execute(request); response = this.httpClient.execute(request);
} catch (IOException e2) {
throw new OpenViduJavaClientException(e2.getMessage(), e2.getCause());
}
try {
int statusCode = response.getStatusLine().getStatusCode(); int statusCode = response.getStatusLine().getStatusCode();
if ((statusCode == org.apache.http.HttpStatus.SC_OK)) { if ((statusCode == org.apache.http.HttpStatus.SC_OK)) {
Recording r = new Recording(httpResponseToJson(response)); Recording r = new Recording(httpResponseToJson(response));
@ -226,10 +222,15 @@ public class OpenVidu {
} else { } else {
throw new OpenViduHttpException(statusCode); throw new OpenViduHttpException(statusCode);
} }
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
} finally { } finally {
if (response != null) {
EntityUtils.consumeQuietly(response.getEntity()); EntityUtils.consumeQuietly(response.getEntity());
} }
} }
}
/** /**
* Starts the recording of a {@link io.openvidu.java.client.Session} * Starts the recording of a {@link io.openvidu.java.client.Session}
@ -334,14 +335,10 @@ public class OpenVidu {
*/ */
public Recording stopRecording(String recordingId) throws OpenViduJavaClientException, OpenViduHttpException { public Recording stopRecording(String recordingId) throws OpenViduJavaClientException, OpenViduHttpException {
HttpPost request = new HttpPost(this.hostname + API_RECORDINGS_STOP + "/" + recordingId); HttpPost request = new HttpPost(this.hostname + API_RECORDINGS_STOP + "/" + recordingId);
HttpResponse response; HttpResponse response = null;
try { try {
response = this.httpClient.execute(request); response = this.httpClient.execute(request);
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
}
try {
int statusCode = response.getStatusLine().getStatusCode(); int statusCode = response.getStatusLine().getStatusCode();
if ((statusCode == org.apache.http.HttpStatus.SC_OK)) { if ((statusCode == org.apache.http.HttpStatus.SC_OK)) {
Recording r = new Recording(httpResponseToJson(response)); Recording r = new Recording(httpResponseToJson(response));
@ -357,10 +354,14 @@ public class OpenVidu {
} else { } else {
throw new OpenViduHttpException(statusCode); throw new OpenViduHttpException(statusCode);
} }
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
} finally { } finally {
if (response != null) {
EntityUtils.consumeQuietly(response.getEntity()); EntityUtils.consumeQuietly(response.getEntity());
} }
} }
}
/** /**
* Gets an existing recording * Gets an existing recording
@ -377,24 +378,25 @@ public class OpenVidu {
*/ */
public Recording getRecording(String recordingId) throws OpenViduJavaClientException, OpenViduHttpException { public Recording getRecording(String recordingId) throws OpenViduJavaClientException, OpenViduHttpException {
HttpGet request = new HttpGet(this.hostname + API_RECORDINGS + "/" + recordingId); HttpGet request = new HttpGet(this.hostname + API_RECORDINGS + "/" + recordingId);
HttpResponse response; HttpResponse response = null;
try { try {
response = this.httpClient.execute(request); response = this.httpClient.execute(request);
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
}
try {
int statusCode = response.getStatusLine().getStatusCode(); int statusCode = response.getStatusLine().getStatusCode();
if ((statusCode == org.apache.http.HttpStatus.SC_OK)) { if ((statusCode == org.apache.http.HttpStatus.SC_OK)) {
return new Recording(httpResponseToJson(response)); return new Recording(httpResponseToJson(response));
} else { } else {
throw new OpenViduHttpException(statusCode); throw new OpenViduHttpException(statusCode);
} }
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
} finally { } finally {
if (response != null) {
EntityUtils.consumeQuietly(response.getEntity()); EntityUtils.consumeQuietly(response.getEntity());
} }
} }
}
/** /**
* Lists all existing recordings * Lists all existing recordings
@ -406,14 +408,10 @@ public class OpenVidu {
*/ */
public List<Recording> listRecordings() throws OpenViduJavaClientException, OpenViduHttpException { public List<Recording> listRecordings() throws OpenViduJavaClientException, OpenViduHttpException {
HttpGet request = new HttpGet(this.hostname + API_RECORDINGS); HttpGet request = new HttpGet(this.hostname + API_RECORDINGS);
HttpResponse response; HttpResponse response = null;
try { try {
response = this.httpClient.execute(request); response = this.httpClient.execute(request);
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
}
try {
int statusCode = response.getStatusLine().getStatusCode(); int statusCode = response.getStatusLine().getStatusCode();
if ((statusCode == org.apache.http.HttpStatus.SC_OK)) { if ((statusCode == org.apache.http.HttpStatus.SC_OK)) {
List<Recording> recordings = new ArrayList<>(); List<Recording> recordings = new ArrayList<>();
@ -426,10 +424,15 @@ public class OpenVidu {
} else { } else {
throw new OpenViduHttpException(statusCode); throw new OpenViduHttpException(statusCode);
} }
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
} finally { } finally {
if (response != null) {
EntityUtils.consumeQuietly(response.getEntity()); EntityUtils.consumeQuietly(response.getEntity());
} }
} }
}
/** /**
* Deletes a recording. The recording must have status * Deletes a recording. The recording must have status
@ -452,22 +455,23 @@ public class OpenVidu {
*/ */
public void deleteRecording(String recordingId) throws OpenViduJavaClientException, OpenViduHttpException { public void deleteRecording(String recordingId) throws OpenViduJavaClientException, OpenViduHttpException {
HttpDelete request = new HttpDelete(this.hostname + API_RECORDINGS + "/" + recordingId); HttpDelete request = new HttpDelete(this.hostname + API_RECORDINGS + "/" + recordingId);
HttpResponse response; HttpResponse response = null;
try { try {
response = this.httpClient.execute(request); response = this.httpClient.execute(request);
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
}
try {
int statusCode = response.getStatusLine().getStatusCode(); int statusCode = response.getStatusLine().getStatusCode();
if (!(statusCode == org.apache.http.HttpStatus.SC_NO_CONTENT)) { if (!(statusCode == org.apache.http.HttpStatus.SC_NO_CONTENT)) {
throw new OpenViduHttpException(statusCode); throw new OpenViduHttpException(statusCode);
} }
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
} finally { } finally {
if (response != null) {
EntityUtils.consumeQuietly(response.getEntity()); EntityUtils.consumeQuietly(response.getEntity());
} }
} }
}
/** /**
* Returns the list of active sessions. <strong>This value will remain unchanged * Returns the list of active sessions. <strong>This value will remain unchanged
@ -519,14 +523,10 @@ public class OpenVidu {
public boolean fetch() throws OpenViduJavaClientException, OpenViduHttpException { public boolean fetch() throws OpenViduJavaClientException, OpenViduHttpException {
HttpGet request = new HttpGet(this.hostname + API_SESSIONS + "?pendingConnections=true"); HttpGet request = new HttpGet(this.hostname + API_SESSIONS + "?pendingConnections=true");
HttpResponse response; HttpResponse response = null;
try { try {
response = this.httpClient.execute(request); response = this.httpClient.execute(request);
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
}
try {
int statusCode = response.getStatusLine().getStatusCode(); int statusCode = response.getStatusLine().getStatusCode();
if ((statusCode == org.apache.http.HttpStatus.SC_OK)) { if ((statusCode == org.apache.http.HttpStatus.SC_OK)) {
@ -581,14 +581,20 @@ public class OpenVidu {
} else { } else {
throw new OpenViduHttpException(statusCode); throw new OpenViduHttpException(statusCode);
} }
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
} finally { } finally {
if (response != null) {
EntityUtils.consumeQuietly(response.getEntity()); EntityUtils.consumeQuietly(response.getEntity());
} }
} }
}
private JsonObject httpResponseToJson(HttpResponse response) throws OpenViduJavaClientException { private JsonObject httpResponseToJson(HttpResponse response) throws OpenViduJavaClientException {
try { try {
JsonObject json = new Gson().fromJson(EntityUtils.toString(response.getEntity(), "UTF-8"), JsonObject.class); JsonObject json = new Gson().fromJson(EntityUtils.toString(response.getEntity(), "UTF-8"),
JsonObject.class);
return json; return json;
} catch (JsonSyntaxException | ParseException | IOException e) { } catch (JsonSyntaxException | ParseException | IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause()); throw new OpenViduJavaClientException(e.getMessage(), e.getCause());

View File

@ -18,7 +18,8 @@
package io.openvidu.java.client; package io.openvidu.java.client;
/** /**
* Defines error responses from OpenVidu Server * Defines error responses from OpenVidu Server. See error codes at
* https://docs.openvidu.io/en/stable/reference-docs/REST-API/
*/ */
public class OpenViduHttpException extends OpenViduException { public class OpenViduHttpException extends OpenViduException {

View File

@ -126,14 +126,10 @@ public class Session {
request.setHeader(HttpHeaders.CONTENT_TYPE, "application/json"); request.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");
request.setEntity(params); request.setEntity(params);
HttpResponse response; HttpResponse response = null;
try { try {
response = this.openVidu.httpClient.execute(request); response = this.openVidu.httpClient.execute(request);
} catch (IOException e2) {
throw new OpenViduJavaClientException(e2.getMessage(), e2.getCause());
}
try {
int statusCode = response.getStatusLine().getStatusCode(); int statusCode = response.getStatusLine().getStatusCode();
if ((statusCode == org.apache.http.HttpStatus.SC_OK)) { if ((statusCode == org.apache.http.HttpStatus.SC_OK)) {
String token = httpResponseToJson(response).get("id").getAsString(); String token = httpResponseToJson(response).get("id").getAsString();
@ -142,10 +138,15 @@ public class Session {
} else { } else {
throw new OpenViduHttpException(statusCode); throw new OpenViduHttpException(statusCode);
} }
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
} finally { } finally {
if (response != null) {
EntityUtils.consumeQuietly(response.getEntity()); EntityUtils.consumeQuietly(response.getEntity());
} }
} }
}
/** /**
* Same as * Same as
@ -189,14 +190,10 @@ public class Session {
request.setHeader(HttpHeaders.CONTENT_TYPE, "application/json"); request.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");
request.setEntity(params); request.setEntity(params);
HttpResponse response; HttpResponse response = null;
try { try {
response = this.openVidu.httpClient.execute(request); response = this.openVidu.httpClient.execute(request);
} catch (IOException e2) {
throw new OpenViduJavaClientException(e2.getMessage(), e2.getCause());
}
try {
int statusCode = response.getStatusLine().getStatusCode(); int statusCode = response.getStatusLine().getStatusCode();
if ((statusCode == org.apache.http.HttpStatus.SC_OK)) { if ((statusCode == org.apache.http.HttpStatus.SC_OK)) {
Connection connection = new Connection(httpResponseToJson(response)); Connection connection = new Connection(httpResponseToJson(response));
@ -205,10 +202,15 @@ public class Session {
} else { } else {
throw new OpenViduHttpException(statusCode); throw new OpenViduHttpException(statusCode);
} }
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
} finally { } finally {
if (response != null) {
EntityUtils.consumeQuietly(response.getEntity()); EntityUtils.consumeQuietly(response.getEntity());
} }
} }
}
/** /**
* Gracefully closes the Session: unpublishes all streams and evicts every * Gracefully closes the Session: unpublishes all streams and evicts every
@ -221,14 +223,10 @@ public class Session {
HttpDelete request = new HttpDelete(this.openVidu.hostname + OpenVidu.API_SESSIONS + "/" + this.sessionId); HttpDelete request = new HttpDelete(this.openVidu.hostname + OpenVidu.API_SESSIONS + "/" + this.sessionId);
request.setHeader(HttpHeaders.CONTENT_TYPE, "application/x-www-form-urlencoded"); request.setHeader(HttpHeaders.CONTENT_TYPE, "application/x-www-form-urlencoded");
HttpResponse response; HttpResponse response = null;
try { try {
response = this.openVidu.httpClient.execute(request); response = this.openVidu.httpClient.execute(request);
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
}
try {
int statusCode = response.getStatusLine().getStatusCode(); int statusCode = response.getStatusLine().getStatusCode();
if ((statusCode == org.apache.http.HttpStatus.SC_NO_CONTENT)) { if ((statusCode == org.apache.http.HttpStatus.SC_NO_CONTENT)) {
this.openVidu.activeSessions.remove(this.sessionId); this.openVidu.activeSessions.remove(this.sessionId);
@ -236,10 +234,15 @@ public class Session {
} else { } else {
throw new OpenViduHttpException(statusCode); throw new OpenViduHttpException(statusCode);
} }
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
} finally { } finally {
if (response != null) {
EntityUtils.consumeQuietly(response.getEntity()); EntityUtils.consumeQuietly(response.getEntity());
} }
} }
}
/** /**
* Updates every property of the Session with the current status it has in * Updates every property of the Session with the current status it has in
@ -268,14 +271,10 @@ public class Session {
this.openVidu.hostname + OpenVidu.API_SESSIONS + "/" + this.sessionId + "?pendingConnections=true"); this.openVidu.hostname + OpenVidu.API_SESSIONS + "/" + this.sessionId + "?pendingConnections=true");
request.setHeader(HttpHeaders.CONTENT_TYPE, "application/x-www-form-urlencoded"); request.setHeader(HttpHeaders.CONTENT_TYPE, "application/x-www-form-urlencoded");
HttpResponse response; HttpResponse response = null;
try { try {
response = this.openVidu.httpClient.execute(request); response = this.openVidu.httpClient.execute(request);
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
}
try {
int statusCode = response.getStatusLine().getStatusCode(); int statusCode = response.getStatusLine().getStatusCode();
if ((statusCode == org.apache.http.HttpStatus.SC_OK)) { if ((statusCode == org.apache.http.HttpStatus.SC_OK)) {
this.resetWithJson(httpResponseToJson(response)); this.resetWithJson(httpResponseToJson(response));
@ -286,10 +285,15 @@ public class Session {
} else { } else {
throw new OpenViduHttpException(statusCode); throw new OpenViduHttpException(statusCode);
} }
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
} finally { } finally {
if (response != null) {
EntityUtils.consumeQuietly(response.getEntity()); EntityUtils.consumeQuietly(response.getEntity());
} }
} }
}
/** /**
* Removes the Connection from the Session. This can translate into a forced * Removes the Connection from the Session. This can translate into a forced
@ -343,11 +347,7 @@ public class Session {
HttpResponse response = null; HttpResponse response = null;
try { try {
response = this.openVidu.httpClient.execute(request); response = this.openVidu.httpClient.execute(request);
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
}
try {
int statusCode = response.getStatusLine().getStatusCode(); int statusCode = response.getStatusLine().getStatusCode();
if ((statusCode == org.apache.http.HttpStatus.SC_NO_CONTENT)) { if ((statusCode == org.apache.http.HttpStatus.SC_NO_CONTENT)) {
// Remove connection from activeConnections map // Remove connection from activeConnections map
@ -370,12 +370,15 @@ public class Session {
} else { } else {
throw new OpenViduHttpException(statusCode); throw new OpenViduHttpException(statusCode);
} }
} finally
{ } catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
} finally {
if (response != null) {
EntityUtils.consumeQuietly(response.getEntity()); EntityUtils.consumeQuietly(response.getEntity());
} }
} }
}
/** /**
* Forces some Connection to unpublish a Stream. OpenVidu Browser will trigger * Forces some Connection to unpublish a Stream. OpenVidu Browser will trigger
@ -423,14 +426,10 @@ public class Session {
this.openVidu.hostname + OpenVidu.API_SESSIONS + "/" + this.sessionId + "/stream/" + streamId); this.openVidu.hostname + OpenVidu.API_SESSIONS + "/" + this.sessionId + "/stream/" + streamId);
request.setHeader(HttpHeaders.CONTENT_TYPE, "application/x-www-form-urlencoded"); request.setHeader(HttpHeaders.CONTENT_TYPE, "application/x-www-form-urlencoded");
HttpResponse response; HttpResponse response = null;
try { try {
response = this.openVidu.httpClient.execute(request); response = this.openVidu.httpClient.execute(request);
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
}
try {
int statusCode = response.getStatusLine().getStatusCode(); int statusCode = response.getStatusLine().getStatusCode();
if ((statusCode == org.apache.http.HttpStatus.SC_NO_CONTENT)) { if ((statusCode == org.apache.http.HttpStatus.SC_NO_CONTENT)) {
for (Connection connection : this.connections.values()) { for (Connection connection : this.connections.values()) {
@ -445,17 +444,22 @@ public class Session {
} else { } else {
throw new OpenViduHttpException(statusCode); throw new OpenViduHttpException(statusCode);
} }
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
} finally { } finally {
if (response != null) {
EntityUtils.consumeQuietly(response.getEntity()); EntityUtils.consumeQuietly(response.getEntity());
} }
} }
}
/** /**
* <a href="https://docs.openvidu.io/en/stable/openvidu-pro/" * <a href="https://docs.openvidu.io/en/stable/openvidu-pro/" style="display:
* style="display: inline-block; background-color: rgb(0, 136, 170); color: * inline-block; background-color: rgb(0, 136, 170); color: white; font-weight:
* white; font-weight: bold; padding: 0px 5px; margin-right: 5px; border-radius: * bold; padding: 0px 5px; margin-right: 5px; border-radius: 3px; font-size:
* 3px; font-size: 13px; line-height:21px; font-family: Montserrat, * 13px; line-height:21px; font-family: Montserrat, sans-serif">PRO</a> Updates
* sans-serif">PRO</a> Updates the properties of a Connection with a * the properties of a Connection with a
* {@link io.openvidu.java.client.ConnectionProperties} object. Only these * {@link io.openvidu.java.client.ConnectionProperties} object. Only these
* properties can be updated: * properties can be updated:
* <ul> * <ul>
@ -474,10 +478,9 @@ public class Session {
* objects.<br> * objects.<br>
* <br> * <br>
* *
* The affected client will trigger one * The affected client will trigger one <a href=
* <a href="/en/stable/api/openvidu-browser/classes/ConnectionPropertyChangedEvent.html"> * "/en/stable/api/openvidu-browser/classes/ConnectionPropertyChangedEvent.html">
* ConnectionPropertyChangedEvent * ConnectionPropertyChangedEvent </a> for each modified property.
* </a> for each modified property.
* *
* @param connectionId The Connection to modify * @param connectionId The Connection to modify
* @param connectionProperties A ConnectionProperties object with the new values * @param connectionProperties A ConnectionProperties object with the new values
@ -499,14 +502,10 @@ public class Session {
request.setHeader(HttpHeaders.CONTENT_TYPE, "application/json"); request.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");
request.setEntity(params); request.setEntity(params);
HttpResponse response; HttpResponse response = null;
try { try {
response = this.openVidu.httpClient.execute(request); response = this.openVidu.httpClient.execute(request);
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
}
try {
int statusCode = response.getStatusLine().getStatusCode(); int statusCode = response.getStatusLine().getStatusCode();
if ((statusCode == org.apache.http.HttpStatus.SC_OK)) { if ((statusCode == org.apache.http.HttpStatus.SC_OK)) {
log.info("Connection {} updated", connectionId); log.info("Connection {} updated", connectionId);
@ -531,10 +530,14 @@ public class Session {
return existingConnection; return existingConnection;
} }
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
} finally { } finally {
if (response != null) {
EntityUtils.consumeQuietly(response.getEntity()); EntityUtils.consumeQuietly(response.getEntity());
} }
} }
}
/** /**
* Returns a Connection of the Session. This method only returns the local * Returns a Connection of the Session. This method only returns the local
@ -649,20 +652,18 @@ public class Session {
request.setHeader(HttpHeaders.CONTENT_TYPE, "application/json"); request.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");
request.setEntity(params); request.setEntity(params);
HttpResponse response; HttpResponse response = null;
try { try {
response = this.openVidu.httpClient.execute(request); response = this.openVidu.httpClient.execute(request);
} catch (IOException e2) {
throw new OpenViduJavaClientException(e2.getMessage(), e2.getCause());
}
try {
int statusCode = response.getStatusLine().getStatusCode(); int statusCode = response.getStatusLine().getStatusCode();
if ((statusCode == org.apache.http.HttpStatus.SC_OK)) { if ((statusCode == org.apache.http.HttpStatus.SC_OK)) {
JsonObject responseJson = httpResponseToJson(response); JsonObject responseJson = httpResponseToJson(response);
this.sessionId = responseJson.get("id").getAsString(); this.sessionId = responseJson.get("id").getAsString();
this.createdAt = responseJson.get("createdAt").getAsLong(); this.createdAt = responseJson.get("createdAt").getAsLong();
// Values that get filled by OpenVidu Server from its global or per-session configuration // Values that get filled by OpenVidu Server from its global or per-session
// configuration
VideoCodec forcedVideoCodec = VideoCodec.valueOf(responseJson.get("forcedVideoCodec").getAsString()); VideoCodec forcedVideoCodec = VideoCodec.valueOf(responseJson.get("forcedVideoCodec").getAsString());
VideoCodec forcedVideoCodecResolved = VideoCodec VideoCodec forcedVideoCodecResolved = VideoCodec
.valueOf(responseJson.get("forcedVideoCodecResolved").getAsString()); .valueOf(responseJson.get("forcedVideoCodecResolved").getAsString());
@ -677,16 +678,18 @@ public class Session {
this.properties = responseProperties; this.properties = responseProperties;
log.info("Session '{}' created", this.sessionId); log.info("Session '{}' created", this.sessionId);
} else if (statusCode == org.apache.http.HttpStatus.SC_CONFLICT) {
// 'customSessionId' already existed
this.sessionId = properties.customSessionId();
} else { } else {
throw new OpenViduHttpException(statusCode); throw new OpenViduHttpException(statusCode);
} }
} catch (IOException e) {
throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
} finally { } finally {
if (response != null) {
EntityUtils.consumeQuietly(response.getEntity()); EntityUtils.consumeQuietly(response.getEntity());
} }
} }
}
private JsonObject httpResponseToJson(HttpResponse response) throws OpenViduJavaClientException { private JsonObject httpResponseToJson(HttpResponse response) throws OpenViduJavaClientException {
JsonObject json; JsonObject json;