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;
}
use of org.springframework.web.util.UriComponentsBuilder in project spring-data-commons by spring-projects.
the class PagedResourcesAssembler method createLink.
/**
* Creates a {@link Link} with the given rel that will be based on the given {@link UriTemplate} but enriched with the
* values of the given {@link Pageable} (if not {@literal null}).
*
* @param base must not be {@literal null}.
* @param pageable can be {@literal null}
* @param rel must not be {@literal null} or empty.
* @return
*/
private Link createLink(UriTemplate base, Pageable pageable, String rel) {
UriComponentsBuilder builder = fromUri(base.expand());
pageableResolver.enhance(builder, getMethodParameter(), pageable);
return new Link(new UriTemplate(builder.build().toString()), rel);
}
use of org.springframework.web.util.UriComponentsBuilder in project spring-data-commons by spring-projects.
the class EnableSpringDataWebSupportIntegrationTests method createsProxyForInterfaceBasedControllerMethodParameter.
// DATACMNS-630
@Test
public void createsProxyForInterfaceBasedControllerMethodParameter() throws Exception {
WebApplicationContext applicationContext = WebTestUtils.createApplicationContext(SampleConfig.class);
MockMvc mvc = MockMvcBuilders.webAppContextSetup(applicationContext).build();
UriComponentsBuilder builder = UriComponentsBuilder.fromUriString("/proxy");
builder.queryParam("name", "Foo");
builder.queryParam("shippingAddresses[0].zipCode", "ZIP");
builder.queryParam("shippingAddresses[0].city", "City");
builder.queryParam("billingAddress.zipCode", "ZIP");
builder.queryParam("billingAddress.city", "City");
builder.queryParam("date", "2014-01-11");
//
mvc.perform(post(builder.build().toString())).andExpect(status().isOk());
}
Aggregations