Example usage for org.springframework.web.client AsyncRestTemplate postForEntity

List of usage examples for org.springframework.web.client AsyncRestTemplate postForEntity

Introduction

In this page you can find the example usage for org.springframework.web.client AsyncRestTemplate postForEntity.

Prototype

@Override
    public <T> ListenableFuture<ResponseEntity<T>> postForEntity(String url, @Nullable HttpEntity<?> request,
            Class<T> responseType, Map<String, ?> uriVariables) throws RestClientException 

Source Link

Usage

From source file:io.getlime.security.powerauth.app.server.service.behavior.CallbackUrlBehavior.java

/**
 * Tries to asynchronously notify all callbacks that are registered for given application.
 * @param applicationId Application for the callbacks to be used.
 * @param activationId Activation ID to be notified about.
 *///www.jav a  2  s  .  c o  m
public void notifyCallbackListeners(Long applicationId, String activationId) {
    final Iterable<CallbackUrlEntity> callbackUrlEntities = callbackUrlRepository
            .findByApplicationIdOrderByName(applicationId);
    Map<String, String> callbackData = new HashMap<>();
    callbackData.put("activationId", activationId);
    AsyncRestTemplate template = new AsyncRestTemplate();
    for (CallbackUrlEntity callbackUrl : callbackUrlEntities) {
        HttpEntity<Map<String, String>> request = new HttpEntity<>(callbackData);
        template.postForEntity(callbackUrl.getCallbackUrl(), request, Map.class, new HashMap<>());
    }
}