use of org.springframework.web.util.UriComponentsBuilder in project mirrorgate-jira-stories-collector by BBVA.
the class SprintService method deleteIssue.
public void deleteIssue(final Long issueId) {
final MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
params.set("collectorId", appName);
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(mirrorGateUrl + MIRRORGATE_DELETE_ISSUE_ENDPOINT).queryParams(params);
try {
restTemplate.delete(builder.build().toUriString(), issueId);
} catch (final HttpClientErrorException e) {
if (e.getStatusCode() == HttpStatus.NOT_FOUND) {
LOGGER.warn("Issue {} already deleted", issueId);
} else {
LOGGER.error("Error trying to delete issue {}", issueId, e);
throw e;
}
}
}
use of org.springframework.web.util.UriComponentsBuilder in project mirrorgate-jira-stories-collector by BBVA.
the class SprintService method sendIssues.
public ResponseEntity<List> sendIssues(final List<IssueDTO> issues) {
final MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
params.set("collectorId", appName);
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(mirrorGateUrl + MIRRORGATE_SEND_ISSUES_ENDPOINT).queryParams(params);
return restTemplate.postForEntity(builder.build().toUriString(), issues, List.class);
}
use of org.springframework.web.util.UriComponentsBuilder in project mirrorgate-jira-stories-collector by BBVA.
the class CollectorService method update.
public void update(final Date date) {
final MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
params.set("collectorId", appName);
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(mirrorGateUrl + MIRRORGATE_COLLECTOR_ENDPOINT).queryParams(params);
restTemplate.put(builder.build().toUriString(), date, appName);
}
use of org.springframework.web.util.UriComponentsBuilder in project cloudstack by apache.
the class Force10BaremetalSwitchBackend method buildLink.
private String buildLink(String switchIp, String path) {
UriComponentsBuilder builder = UriComponentsBuilder.newInstance();
builder.scheme("http");
builder.host(switchIp);
builder.port(8008);
builder.path(path);
return builder.build().toUriString();
}
use of org.springframework.web.util.UriComponentsBuilder in project dhis2-core by dhis2.
the class SimplisticHttpGetGateWay method send.
@Override
public OutboundMessageResponse send(String subject, String text, Set<String> recipients, SmsGatewayConfig config) {
GenericHttpGatewayConfig genericConfig = (GenericHttpGatewayConfig) config;
UriComponentsBuilder uriBuilder;
ResponseEntity<String> responseEntity = null;
HttpEntity<String> requestEntity;
URI uri;
try {
requestEntity = getRequestEntity(genericConfig, text, recipients);
if (genericConfig.isSendUrlParameters()) {
uriBuilder = UriComponentsBuilder.fromHttpUrl(config.getUrlTemplate() + "?" + requestEntity.getBody());
} else {
uriBuilder = UriComponentsBuilder.fromHttpUrl(config.getUrlTemplate());
}
uri = uriBuilder.build().encode().toUri();
responseEntity = restTemplate.exchange(uri, genericConfig.isUseGet() ? HttpMethod.GET : HttpMethod.POST, requestEntity, String.class);
} catch (HttpClientErrorException ex) {
log.error("Client error " + ex.getMessage());
} catch (HttpServerErrorException ex) {
log.error("Server error " + ex.getMessage());
} catch (Exception ex) {
log.error("Error " + ex.getMessage());
}
return getResponse(responseEntity);
}
Aggregations