APISonar


com.aliyuncs.http.FormatType.JSON

> com > aliyuncs > http > FormatType > JSON
com APIs aliyuncs APIs http APIs FormatType APIs JSON APIs

Example 1
public CommonRoaRequest(String product) {
        super(product);
        setSysAcceptFormat(FormatType.JSON);
    }
Example 2
public static Reader createInstance(FormatType format) {
        if (FormatType.JSON == format) {
            return new JsonReader();
        }
        if (FormatType.XML == format) {
            return new XmlReader();
        }

        throw new IllegalStateException("Server response has a bad format type: " + format);
    }
Example 3
public Map<String, String> refreshSignParameters(Map<String, String> parameters, Signer signer, String accessKeyId,
            FormatType format) {
        Map<String, String> immutableMap = new HashMap<String, String>(parameters);
        immutableMap.put("Date", ParameterHelper.getRFC2616Date(new Date()));
        if (null == format) {
            format = FormatType.JSON;
        }
        immutableMap.put("Accept", FormatType.mapFormatToAccept(format));
        immutableMap.put("x-acs-signature-method", signer.getSignerName());
        immutableMap.put("x-acs-signature-version", signer.getSignerVersion());
        if (signer.getSignerType() != null) {
            immutableMap.put("x-acs-signature-type", signer.getSignerType());
        }
        return immutableMap;
    }
Example 4
public void getUnmarshallerTest() {
        Unmarshaller unmarshaller = UnmarshallerFactory.getUnmarshaller(FormatType.XML);
        Assert.assertTrue("is xml unmarshaller", unmarshaller.getClass() == XmlUnmashaller.class);
        Unmarshaller unmarshaller2 = UnmarshallerFactory.getUnmarshaller(FormatType.JSON);
        Assert.assertTrue("is json unmarshaller", unmarshaller2.getClass() == JsonUnmashaller.class);
        try {
            UnmarshallerFactory.getUnmarshaller(FormatType.FORM);
        } catch (Exception e) {
            Assert.assertEquals("Unsupported response format: FORM", e.getMessage());
            return;
        }
        Assert.fail();
    }
Example 5
public CommonRoaRequest(String product, String version, String action, String locationProduct,
                            String endpointType) {
        super(product, version, action, locationProduct, endpointType);
        setSysAcceptFormat(FormatType.JSON);
    }