Search in sources :

Example 36 with SdkHttpFullResponse

use of software.amazon.awssdk.http.SdkHttpFullResponse in project aws-sdk-java-v2 by aws.

the class QueryProtocolUnmarshaller method unmarshall.

public <TypeT extends SdkPojo> Pair<TypeT, Map<String, String>> unmarshall(SdkPojo sdkPojo, SdkHttpFullResponse response) {
    if (responsePayloadIsBlob(sdkPojo)) {
        XmlElement document = XmlElement.builder().textContent(response.content().map(s -> invokeSafely(() -> IoUtils.toUtf8String(s))).orElse("")).build();
        return Pair.of(unmarshall(sdkPojo, document, response), new HashMap<>());
    }
    XmlElement document = response.content().map(XmlDomParser::parse).orElseGet(XmlElement::empty);
    XmlElement resultRoot = hasResultWrapper ? document.getFirstChild() : document;
    return Pair.of(unmarshall(sdkPojo, resultRoot, response), parseMetadata(document));
}
Also used : SimpleTypeQueryMarshaller.defaultTimestampFormats(software.amazon.awssdk.protocols.query.internal.marshall.SimpleTypeQueryMarshaller.defaultTimestampFormats) StringToValueConverter(software.amazon.awssdk.protocols.core.StringToValueConverter) StringToInstant(software.amazon.awssdk.protocols.core.StringToInstant) Pair(software.amazon.awssdk.utils.Pair) HashMap(java.util.HashMap) AWS_REQUEST_ID(software.amazon.awssdk.awscore.util.AwsHeader.AWS_REQUEST_ID) SdkField(software.amazon.awssdk.core.SdkField) MarshallingType(software.amazon.awssdk.core.protocol.MarshallingType) XmlDomParser(software.amazon.awssdk.protocols.query.unmarshall.XmlDomParser) SdkBytes(software.amazon.awssdk.core.SdkBytes) FunctionalUtils.invokeSafely(software.amazon.awssdk.utils.FunctionalUtils.invokeSafely) List(java.util.List) CollectionUtils(software.amazon.awssdk.utils.CollectionUtils) XmlElement(software.amazon.awssdk.protocols.query.unmarshall.XmlElement) Map(java.util.Map) XmlErrorUnmarshaller(software.amazon.awssdk.protocols.query.unmarshall.XmlErrorUnmarshaller) SdkPojo(software.amazon.awssdk.core.SdkPojo) PayloadTrait(software.amazon.awssdk.core.traits.PayloadTrait) SdkHttpFullResponse(software.amazon.awssdk.http.SdkHttpFullResponse) SdkInternalApi(software.amazon.awssdk.annotations.SdkInternalApi) Buildable(software.amazon.awssdk.utils.builder.Buildable) IoUtils(software.amazon.awssdk.utils.IoUtils) XmlElement(software.amazon.awssdk.protocols.query.unmarshall.XmlElement)

Aggregations

SdkHttpFullResponse (software.amazon.awssdk.http.SdkHttpFullResponse)36 Test (org.junit.jupiter.api.Test)12 Test (org.junit.Test)11 AbortableInputStream (software.amazon.awssdk.http.AbortableInputStream)10 InputStream (java.io.InputStream)6 List (java.util.List)6 ExecutableHttpRequest (software.amazon.awssdk.http.ExecutableHttpRequest)6 StringInputStream (software.amazon.awssdk.utils.StringInputStream)6 XmlElement (software.amazon.awssdk.protocols.query.unmarshall.XmlElement)5 ByteArrayInputStream (java.io.ByteArrayInputStream)4 Duration (java.time.Duration)4 GZIPInputStream (java.util.zip.GZIPInputStream)4 Before (org.junit.Before)4 SdkBytes (software.amazon.awssdk.core.SdkBytes)4 SdkPojo (software.amazon.awssdk.core.SdkPojo)4 Crc32ChecksumValidatingInputStream (software.amazon.awssdk.core.internal.util.Crc32ChecksumValidatingInputStream)4 HttpExecuteResponse (software.amazon.awssdk.http.HttpExecuteResponse)4 IOException (java.io.IOException)3 ByteBuffer (java.nio.ByteBuffer)3 Map (java.util.Map)3