use of org.springframework.web.util.UriComponentsBuilder in project java-chassis by ServiceComb.
the class CseUriTemplateHandler method expandInternal.
@Override
protected URI expandInternal(String uriTemplate, Map<String, ?> uriVariables) {
UriComponentsBuilder uriComponentsBuilder = initUriComponentsBuilder(uriTemplate);
UriComponents uriComponents = expandAndEncode(uriComponentsBuilder, uriVariables);
return createUri(uriTemplate, uriComponentsBuilder, uriComponents);
}
use of org.springframework.web.util.UriComponentsBuilder in project dhis2-core by dhis2.
the class BulkSmsGateway method sendBatch.
// -------------------------------------------------------------------------
// Implementation
// -------------------------------------------------------------------------
@Override
public List<OutboundMessageResponse> sendBatch(OutboundMessageBatch smsBatch, SmsGatewayConfig config) {
BulkSmsGatewayConfig bulkSmsConfig = (BulkSmsGatewayConfig) config;
UriComponentsBuilder uriBuilder = buildBaseUrl(bulkSmsConfig, SubmissionType.BATCH);
uriBuilder.queryParam("batch_data", buildCsvUrl(smsBatch.getMessages()));
return Lists.newArrayList(send(uriBuilder));
}
use of org.springframework.web.util.UriComponentsBuilder in project dhis2-core by dhis2.
the class BulkSmsGateway method createUri.
// -------------------------------------------------------------------------
// Supportive methods
// -------------------------------------------------------------------------
private UriComponentsBuilder createUri(BulkSmsGatewayConfig bulkSmsConfig, Set<String> recipients, SubmissionType type) {
UriComponentsBuilder uriBuilder = buildBaseUrl(bulkSmsConfig, type);
uriBuilder.queryParam("msisdn", getRecipients(recipients));
return uriBuilder;
}
use of org.springframework.web.util.UriComponentsBuilder in project dhis2-core by dhis2.
the class BulkSmsGateway method send.
@Override
public OutboundMessageResponse send(String subject, String text, Set<String> recipients, SmsGatewayConfig config) {
UriComponentsBuilder uriBuilder = createUri((BulkSmsGatewayConfig) config, recipients, SubmissionType.SINGLE);
uriBuilder.queryParam("message", text);
return send(uriBuilder);
}
use of org.springframework.web.util.UriComponentsBuilder in project dhis2-core by dhis2.
the class SimplisticHttpGetGateWay method buildUrl.
// -------------------------------------------------------------------------
// Supportive methods
// -------------------------------------------------------------------------
private UriComponentsBuilder buildUrl(GenericHttpGatewayConfig config, String text, Set<String> recipients) {
UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromHttpUrl(config.getUrlTemplate());
uriBuilder = getUrlParameters(config.getParameters(), uriBuilder);
uriBuilder.queryParam(config.getMessageParameter(), text);
uriBuilder.queryParam(config.getRecipientParameter(), !recipients.isEmpty() ? recipients.iterator().next() : "");
return uriBuilder;
}
Aggregations