SEBSERV-492 fixed PATCH instead of POST
This commit is contained in:
parent
7a3ccdbb34
commit
491715aea9
1 changed files with 19 additions and 4 deletions
|
@ -27,6 +27,8 @@ import javax.crypto.Mac;
|
|||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
||||
import org.joda.time.Interval;
|
||||
|
@ -40,7 +42,7 @@ import org.springframework.http.HttpMethod;
|
|||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.security.oauth2.client.OAuth2RestTemplate;
|
||||
import org.springframework.security.oauth2.client.resource.BaseOAuth2ProtectedResourceDetails;
|
||||
|
@ -565,6 +567,10 @@ public class ZoomProctoringService implements ExamProctoringService {
|
|||
meetingPwd,
|
||||
this.enableWaitingRoom);
|
||||
|
||||
if (createMeeting.getStatusCodeValue() >= 400) {
|
||||
throw new RuntimeException("Failed to create new Zoom room: " + createMeeting.getBody());
|
||||
}
|
||||
|
||||
final MeetingResponse meetingResponse = this.jsonMapper.readValue(
|
||||
createMeeting.getBody(),
|
||||
MeetingResponse.class);
|
||||
|
@ -822,7 +828,12 @@ public class ZoomProctoringService implements ExamProctoringService {
|
|||
final HttpHeaders headers = getHeaders();
|
||||
|
||||
headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
|
||||
final ResponseEntity<String> exchange = exchange(url, HttpMethod.POST, body, headers);
|
||||
final ResponseEntity<String> exchange = exchange(url, HttpMethod.PATCH, body, headers);
|
||||
final int statusCodeValue = exchange.getStatusCodeValue();
|
||||
if (statusCodeValue >= 400) {
|
||||
log.warn("Failed to apply user settings for Zoom user: {} response: {}", userId, exchange);
|
||||
}
|
||||
|
||||
return exchange;
|
||||
} catch (final Exception e) {
|
||||
log.error("Failed to apply user settings for Zoom user: {}", userId, e);
|
||||
|
@ -1007,8 +1018,12 @@ public class ZoomProctoringService implements ExamProctoringService {
|
|||
this.resource.setGrantType("account_credentials");
|
||||
this.resource.setId(this.proctoringSettings.accountId);
|
||||
|
||||
final SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
|
||||
requestFactory.setOutputStreaming(false);
|
||||
final HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
|
||||
final HttpClient httpClient = HttpClientBuilder.create()
|
||||
.disableCookieManagement()
|
||||
.useSystemProperties()
|
||||
.build();
|
||||
requestFactory.setHttpClient(httpClient);
|
||||
final OAuth2RestTemplate oAuth2RestTemplate = new OAuth2RestTemplate(this.resource);
|
||||
oAuth2RestTemplate.setRequestFactory(requestFactory);
|
||||
oAuth2RestTemplate.setAccessTokenProvider(new ZoomCredentialsAccessTokenProvider());
|
||||
|
|
Loading…
Add table
Reference in a new issue