本文整理汇总了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);
}
}