当前位置: 首页>>代码示例>>Java>>正文


Java MwsUtl类代码示例

本文整理汇总了Java中com.amazonservices.mws.client.MwsUtl的典型用法代码示例。如果您正苦于以下问题:Java MwsUtl类的具体用法?Java MwsUtl怎么用?Java MwsUtl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MwsUtl类属于com.amazonservices.mws.client包,在下文中一共展示了MwsUtl类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setServiceURL

import com.amazonservices.mws.client.MwsUtl; //导入依赖的package包/类
/**
 * Set the service URL to make requests against.
 *
 * This can either be just the host name or can include the full path to the service.
 *
 * @param serviceUrl URL to make requests against
 */
public void setServiceURL(String serviceUrl) {
    try {
        URI fullURI = URI.create(serviceUrl);
        URI partialURI = new URI(fullURI.getScheme(), null, fullURI.getHost(),
            fullURI.getPort(), null, null, null);
        cc.setEndpoint(partialURI);
        String path = fullURI.getPath();
        if (path != null) {
            path = path.substring(path.startsWith("/") ? 1 : 0);
            path = path.substring(0, path.length() - (path.endsWith("/") ? 1 : 0));
        }
        if (path == null || path.isEmpty()) {
            this.servicePath = DEFAULT_SERVICE_PATH;
        } else {
            this.servicePath = path;
        }
    } catch (Exception e) {
        throw MwsUtl.wrap(e);
    }
}
 
开发者ID:trifonnt,项目名称:ext-lib-amazon-mws-fulfillment-inbound-shipment,代码行数:28,代码来源:FBAInboundServiceMWSConfig.java

示例2: newResponse

import com.amazonservices.mws.client.MwsUtl; //导入依赖的package包/类
/**
 * Create a new response object.
 * 
 * @param cls
 * 
 * @return The object.
 */
private <T extends MwsObject> T newResponse(
        Class<T> cls) {
    InputStream is = null;
    try {
        is = this.getClass().getResourceAsStream(cls.getSimpleName()+".xml");
        MwsXmlReader reader = new MwsXmlReader(is);
        T obj = cls.newInstance();
        obj.readFragmentFrom(reader);
        ResponseHeaderMetadata rhmd = new ResponseHeaderMetadata(
            "mockRequestId", Arrays.asList("A","B","C"), "mockTimestamp", 0d, 0d, new Date());
        cls.getMethod("setResponseHeaderMetadata", rhmd.getClass()).invoke(obj,  rhmd);
        return obj;
    } catch (Exception e) {
        throw MwsUtl.wrap(e);
    } finally {
        MwsUtl.close(is);
    }
}
 
开发者ID:trifonnt,项目名称:ext-lib-amazon-mws-fulfillment-inbound-shipment,代码行数:26,代码来源:FBAInboundServiceMWSMock.java

示例3: formatXml

import com.amazonservices.mws.client.MwsUtl; //导入依赖的package包/类
public static String formatXml(Node node) {
    try {
        Transformer transformer = MwsUtl.getTF().newTransformer();
        transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
        transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
        transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
        StringWriter sw = new StringWriter();
        StreamResult result = new StreamResult(sw);
        DOMSource source = new DOMSource(node);
        transformer.transform(source, result);
        return sw.toString();
    } catch (TransformerException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:Ac2zoom,项目名称:giftgenie.io,代码行数:17,代码来源:ProductsUtil.java


注:本文中的com.amazonservices.mws.client.MwsUtl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。