Search in sources :

Example 1 with XmlDomParser

use of software.amazon.awssdk.protocols.query.unmarshall.XmlDomParser 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

HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 SdkInternalApi (software.amazon.awssdk.annotations.SdkInternalApi)1 AWS_REQUEST_ID (software.amazon.awssdk.awscore.util.AwsHeader.AWS_REQUEST_ID)1 SdkBytes (software.amazon.awssdk.core.SdkBytes)1 SdkField (software.amazon.awssdk.core.SdkField)1 SdkPojo (software.amazon.awssdk.core.SdkPojo)1 MarshallingType (software.amazon.awssdk.core.protocol.MarshallingType)1 PayloadTrait (software.amazon.awssdk.core.traits.PayloadTrait)1 SdkHttpFullResponse (software.amazon.awssdk.http.SdkHttpFullResponse)1 StringToInstant (software.amazon.awssdk.protocols.core.StringToInstant)1 StringToValueConverter (software.amazon.awssdk.protocols.core.StringToValueConverter)1 SimpleTypeQueryMarshaller.defaultTimestampFormats (software.amazon.awssdk.protocols.query.internal.marshall.SimpleTypeQueryMarshaller.defaultTimestampFormats)1 XmlDomParser (software.amazon.awssdk.protocols.query.unmarshall.XmlDomParser)1 XmlElement (software.amazon.awssdk.protocols.query.unmarshall.XmlElement)1 XmlErrorUnmarshaller (software.amazon.awssdk.protocols.query.unmarshall.XmlErrorUnmarshaller)1 CollectionUtils (software.amazon.awssdk.utils.CollectionUtils)1 FunctionalUtils.invokeSafely (software.amazon.awssdk.utils.FunctionalUtils.invokeSafely)1 IoUtils (software.amazon.awssdk.utils.IoUtils)1