本文整理了Java中org.springframework.security.oauth2.client.OAuth2RestTemplate.postForEntity()
方法的一些代码示例,展示了OAuth2RestTemplate.postForEntity()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OAuth2RestTemplate.postForEntity()
方法的具体详情如下:
包路径:org.springframework.security.oauth2.client.OAuth2RestTemplate
类名称:OAuth2RestTemplate
方法名:postForEntity
暂无
代码示例来源:origin: kbastani/spring-cloud-event-sourcing-example
oAuth2RestTemplate.postForEntity(String.format("http://order-service/v1/orders/%s/events", orderResponse.getOrderId()),
new OrderEvent(OrderEventType.CREATED, orderResponse.getOrderId()), ResponseEntity.class);
代码示例来源:origin: com.bosch.bis.monitoring/bis-event-publisher-impl
@Override
public UUID call(RetryContext retryContext) throws Exception {
LOG.info("Using URL " + woodpeckerPublishUri.getUri() + " to publish model data.");
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<PublishedAppModel> httpEntity = new HttpEntity<>(model, headers);
int n = retryContext.getRetryCount() + 1;
LOG.info("Attempt " + n + " to publish model data. ");
try {
ResponseEntity<String> response = connection.getOauth2RestTemplate().postForEntity(woodpeckerPublishUri.getUri(),
httpEntity, String.class);
if (response.getStatusCode() == HttpStatus.OK) {
String responseBody = response.getBody();
return UUID.fromString(responseBody);
} else {
String reasonPhrase = response.getStatusCode().getReasonPhrase();
throw new ModelDataServiceException(
"BIS Monitoring: Failed to publish data to model service (woodpecker): " + reasonPhrase);
}
} catch (ResourceAccessException e) {
LOG.error("Publishing failed: " + e.getMessage());
throw e;
}
}
}
代码示例来源:origin: chaokunyang/microservices-event-sourcing
oAuth2RestTemplate.postForEntity(
String.format("http://order-service/v1/orders/%s/events", order.getOrderId()),
new OrderEvent(OrderEventType.CREATED, order.getOrderId()), ResponseEntity.class);
内容来源于网络,如有侵权,请联系作者删除!