Search in sources :

Example 16 with DeliveryResponse

use of com.adobe.target.delivery.v1.model.DeliveryResponse in project target-java-sdk by adobe.

the class DefaultTargetService method executeRequest.

@Override
public TargetDeliveryResponse executeRequest(TargetDeliveryRequest deliveryRequest) {
    TimingTool timer = new TimingTool();
    timer.timeStart(TIMING_EXECUTE_REQUEST);
    TargetDeliveryResponse targetDeliveryResponse;
    Telemetry telemetry = telemetryService.getTelemetry();
    if (!telemetry.getEntries().isEmpty()) {
        deliveryRequest.getDeliveryRequest().setTelemetry(telemetry);
    }
    ResponseWrapper<DeliveryResponse> response = callDeliveryApi(deliveryRequest);
    targetDeliveryResponse = getTargetDeliveryResponse(deliveryRequest, response.getHttpResponse());
    /* capture Telemetry information once original request's response is received */
    telemetryService.addTelemetry(deliveryRequest, timer, targetDeliveryResponse, response.getParsingTime(), response.getResponseSize());
    return targetDeliveryResponse;
}
Also used : TimingTool(com.adobe.target.edge.client.utils.TimingTool) TargetDeliveryResponse(com.adobe.target.edge.client.model.TargetDeliveryResponse) Telemetry(com.adobe.target.delivery.v1.model.Telemetry) TargetDeliveryResponse(com.adobe.target.edge.client.model.TargetDeliveryResponse) DeliveryResponse(com.adobe.target.delivery.v1.model.DeliveryResponse)

Example 17 with DeliveryResponse

use of com.adobe.target.delivery.v1.model.DeliveryResponse in project target-java-sdk by adobe.

the class TargetAttributesResponse method toMap.

private static Map<String, Map<String, Object>> toMap(TargetDeliveryResponse targetResponse) {
    if (targetResponse == null) {
        return null;
    }
    Map<String, Map<String, Object>> result = new HashMap<>();
    String globalMbox = getGlobalMbox(targetResponse);
    DeliveryResponse response = targetResponse.getResponse();
    PrefetchResponse prefetchResponse = response.getPrefetch();
    ExecuteResponse executeResponse = response.getExecute();
    processPrefetch(result, prefetchResponse, globalMbox);
    processExecute(result, executeResponse, globalMbox);
    return toReadOnlyMap(result);
}
Also used : PrefetchResponse(com.adobe.target.delivery.v1.model.PrefetchResponse) HashMap(java.util.HashMap) ExecuteResponse(com.adobe.target.delivery.v1.model.ExecuteResponse) DeliveryResponse(com.adobe.target.delivery.v1.model.DeliveryResponse) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

DeliveryResponse (com.adobe.target.delivery.v1.model.DeliveryResponse)15 TargetDeliveryResponse (com.adobe.target.edge.client.model.TargetDeliveryResponse)12 TargetDeliveryRequest (com.adobe.target.edge.client.model.TargetDeliveryRequest)11 TargetTestDeliveryRequestUtils.getTestDeliveryResponse (com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getTestDeliveryResponse)10 TimingTool (com.adobe.target.edge.client.utils.TimingTool)10 Test (org.junit.jupiter.api.Test)10 Context (com.adobe.target.delivery.v1.model.Context)6 ExecuteRequest (com.adobe.target.delivery.v1.model.ExecuteRequest)6 TargetTestDeliveryRequestUtils.getContext (com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getContext)6 TargetTestDeliveryRequestUtils.getMboxExecuteRequest (com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getMboxExecuteRequest)6 TargetTestDeliveryRequestUtils.getNoContentDeliveryResponse (com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getNoContentDeliveryResponse)6 DeliveryRequest (com.adobe.target.delivery.v1.model.DeliveryRequest)5 PrefetchRequest (com.adobe.target.delivery.v1.model.PrefetchRequest)5 Property (com.adobe.target.delivery.v1.model.Property)5 Map (java.util.Map)5 Telemetry (com.adobe.target.delivery.v1.model.Telemetry)4 TelemetryEntry (com.adobe.target.delivery.v1.model.TelemetryEntry)4 ExecuteResponse (com.adobe.target.delivery.v1.model.ExecuteResponse)2 PrefetchResponse (com.adobe.target.delivery.v1.model.PrefetchResponse)2 ResponseStatus (com.adobe.target.edge.client.http.ResponseStatus)2