pull/821/merge
Choi Jong Myung 2024-06-23 11:33:21 +03:00 committed by GitHub
commit 8271144813
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 116 additions and 140 deletions

View File

@ -123,9 +123,7 @@ public class Session {
this.getSessionId();
}
final HttpClientResponseHandler<String> responseHandler = new HttpClientResponseHandler<String>() {
@Override
public String handleResponse(final ClassicHttpResponse response) throws IOException, HttpException {
final HttpClientResponseHandler<String> responseHandler = response -> {
final int status = response.getCode();
if (status == HttpStatus.SC_OK) {
String token = OpenVidu.httpResponseEntityToJson(response.getEntity()).get("id").getAsString();
@ -134,7 +132,6 @@ public class Session {
} else {
throw OpenVidu.openViduHttpException(status);
}
}
};
JsonObject json = tokenOptions.toJsonObject(sessionId);
@ -186,9 +183,7 @@ public class Session {
this.getSessionId();
}
final HttpClientResponseHandler<Connection> responseHandler = new HttpClientResponseHandler<Connection>() {
@Override
public Connection handleResponse(final ClassicHttpResponse response) throws IOException, HttpException {
final HttpClientResponseHandler<Connection> responseHandler = response -> {
final int status = response.getCode();
if (status == HttpStatus.SC_OK) {
Connection connection = new Connection(OpenVidu.httpResponseEntityToJson(response.getEntity()));
@ -197,7 +192,6 @@ public class Session {
} else {
throw OpenVidu.openViduHttpException(status);
}
}
};
JsonObject json = connectionProperties.toJson(sessionId);
@ -224,9 +218,7 @@ public class Session {
*/
public void close() throws OpenViduJavaClientException, OpenViduHttpException {
final HttpClientResponseHandler<Void> responseHandler = new HttpClientResponseHandler<Void>() {
@Override
public Void handleResponse(final ClassicHttpResponse response) throws IOException, HttpException {
final HttpClientResponseHandler<Void> responseHandler = response -> {
final int status = response.getCode();
if (status == HttpStatus.SC_NO_CONTENT) {
openVidu.activeSessions.remove(sessionId);
@ -235,7 +227,6 @@ public class Session {
throw OpenVidu.openViduHttpException(status);
}
return null;
}
};
HttpDelete request = new HttpDelete(this.openVidu.hostname + OpenVidu.API_SESSIONS + "/" + this.sessionId);
@ -272,9 +263,7 @@ public class Session {
final String beforeJSON = this.toJson();
final HttpClientResponseHandler<Boolean> responseHandler = new HttpClientResponseHandler<Boolean>() {
@Override
public Boolean handleResponse(final ClassicHttpResponse response) throws IOException, HttpException {
final HttpClientResponseHandler<Boolean> responseHandler = response -> {
final int status = response.getCode();
if (status == HttpStatus.SC_OK) {
resetWithJson(OpenVidu.httpResponseEntityToJson(response.getEntity()));
@ -285,7 +274,6 @@ public class Session {
} else {
throw OpenVidu.openViduHttpException(status);
}
}
};
HttpGet request = new HttpGet(
@ -344,9 +332,7 @@ public class Session {
*/
public void forceDisconnect(String connectionId) throws OpenViduJavaClientException, OpenViduHttpException {
final HttpClientResponseHandler<Void> responseHandler = new HttpClientResponseHandler<Void>() {
@Override
public Void handleResponse(final ClassicHttpResponse response) throws IOException, HttpException {
final HttpClientResponseHandler<Void> responseHandler = response -> {
final int status = response.getCode();
if (status == HttpStatus.SC_NO_CONTENT) {
// Remove connection from activeConnections map
@ -371,7 +357,6 @@ public class Session {
throw OpenVidu.openViduHttpException(status);
}
return null;
}
};
HttpDelete request = new HttpDelete(
@ -427,9 +412,7 @@ public class Session {
*/
public void forceUnpublish(String streamId) throws OpenViduJavaClientException, OpenViduHttpException {
final HttpClientResponseHandler<Void> responseHandler = new HttpClientResponseHandler<Void>() {
@Override
public Void handleResponse(final ClassicHttpResponse response) throws IOException, HttpException {
final HttpClientResponseHandler<Void> responseHandler = response -> {
final int status = response.getCode();
if (status == HttpStatus.SC_NO_CONTENT) {
for (Connection connection : connections.values()) {
@ -445,7 +428,6 @@ public class Session {
throw OpenVidu.openViduHttpException(status);
}
return null;
}
};
HttpDelete request = new HttpDelete(
@ -499,9 +481,7 @@ public class Session {
public Connection updateConnection(String connectionId, ConnectionProperties connectionProperties)
throws OpenViduJavaClientException, OpenViduHttpException {
final HttpClientResponseHandler<Connection> responseHandler = new HttpClientResponseHandler<Connection>() {
@Override
public Connection handleResponse(final ClassicHttpResponse response) throws IOException, HttpException {
final HttpClientResponseHandler<Connection> responseHandler = response -> {
final int status = response.getCode();
if (status == HttpStatus.SC_OK) {
log.info("Connection {} updated", connectionId);
@ -525,7 +505,6 @@ public class Session {
existingConnection.overrideConnectionProperties(connectionProperties);
return existingConnection;
}
}
};
JsonObject json = connectionProperties.toJson(this.sessionId);
@ -657,9 +636,7 @@ public class Session {
return;
}
final HttpClientResponseHandler<Void> responseHandler = new HttpClientResponseHandler<Void>() {
@Override
public Void handleResponse(final ClassicHttpResponse response) throws IOException, HttpException {
final HttpClientResponseHandler<Void> responseHandler = response -> {
final int status = response.getCode();
if (status == HttpStatus.SC_OK) {
JsonObject responseJson = OpenVidu.httpResponseEntityToJson(response.getEntity());
@ -692,7 +669,6 @@ public class Session {
throw OpenVidu.openViduHttpException(status);
}
return null;
}
};
JsonObject json = properties.toJson();