本文整理了Java中org.apache.axiom.om.OMText.setOptimize()
方法的一些代码示例,展示了OMText.setOptimize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OMText.setOptimize()
方法的具体详情如下:
包路径:org.apache.axiom.om.OMText
类名称:OMText
方法名:setOptimize
[英]Sets the optimize flag.
[中]设置优化标志。
代码示例来源:origin: org.apache.rampart/rampart-core
/**
* Mark the requied Base64 text values as optimized
* @param env
* @param optimizeParts This is a set of xPath expressions
*
* @throws WSSecurityException
*/
public static void optimize(SOAPEnvelope env, String optimizeParts) throws WSSecurityException {
String separater = "<>";
StringTokenizer tokenizer = new StringTokenizer(optimizeParts, separater);
while(tokenizer.hasMoreTokens()) {
String xpathExpr = tokenizer.nextToken();
//Find binary content
List list = findElements(env,xpathExpr);
Iterator cipherValueElements = list.iterator();
while (cipherValueElements.hasNext()) {
OMElement element = (OMElement) cipherValueElements.next();
OMText text = (OMText)element.getFirstOMChild();
text.setOptimize(true);
}
}
}
代码示例来源:origin: apache/axis2-java
public OMElement echoMTOMtoBase64(OMElement omEle) {
OMText omText = (OMText)(omEle.getFirstElement()).getFirstOMChild();
omText.setOptimize(false);
return omEle;
}
}
代码示例来源:origin: org.apache.axis2.transport/axis2-transport-testkit
public OMElement echoMTOMtoBase64(OMElement omEle) {
OMText omText = (OMText)(omEle.getFirstElement()).getFirstOMChild();
omText.setOptimize(false);
return omEle;
}
}
代码示例来源:origin: org.apache.axis2/axis2-transport-testkit
public OMElement echoMTOMtoBase64(OMElement omEle) {
OMText omText = (OMText)(omEle.getFirstElement()).getFirstOMChild();
omText.setOptimize(false);
return omEle;
}
}
代码示例来源:origin: org.apache.sandesha2/sandesha2-samples
public void MTOMPing(OMElement in) throws Exception {
OMElement attachmentElem = in.getFirstChildWithName(new QName(applicationNamespaceName, Attachment));
if (attachmentElem == null)
throw new AxisFault("'Attachment' element is not present as a child of the 'Ping' element");
OMText binaryElem = (OMText) attachmentElem.getFirstOMChild();
binaryElem.setOptimize(true);
DataHandler dataHandler = (DataHandler) binaryElem.getDataHandler();
try {
File destinationFile = new File(DESTINATION_IMAGE_FILE);
if (destinationFile.exists())
destinationFile.delete();
FileOutputStream fileOutputStream = new FileOutputStream(DESTINATION_IMAGE_FILE);
InputStream inputStream = dataHandler.getDataSource().getInputStream();
byte[] bytes = new byte[5000];
int length = inputStream.read(bytes);
fileOutputStream.write(bytes, 0, length);
fileOutputStream.close();
} catch (Exception e) {
throw AxisFault.makeFault(e);
}
}
}
代码示例来源:origin: usnistgov/iheos-toolkit2
public OMElement getBody() {
OMElement sor = MetadataSupport.firstChildWithLocalName(metadataEle, "SubmitObjectsRequest");
if (sor == null) {
String msg = "MtomBuilder: cannot find SubmitObjectsRequest child in PnR";
logger.error(msg);
throw new ToolkitRuntimeException(msg);
}
for (String id : documentMap.getIds()) {
Document document = documentMap.getDocument(id);
javax.activation.DataHandler dataHandler = new javax.activation.DataHandler(document.getDataSource());
OMText t = MetadataSupport.om_factory.createOMText(dataHandler, true);
t.setOptimize(true);
OMElement documentEle = MetadataSupport.om_factory.createOMElement("Document", MetadataSupport.xdsB);
documentEle.addAttribute("id", id, null);
documentEle.addChild(t);
// metadataEle.addChild(documentEle);
sor.insertSiblingAfter(documentEle);
}
return metadataEle;
}
代码示例来源:origin: org.apache.rampart/rampart-core
public static void optimize(SOAPEnvelope env, List<String> expressions, Map namespaces) throws RampartException {
SimpleNamespaceContext nsCtx = new SimpleNamespaceContext();
nsCtx.addNamespace(WSConstants.ENC_PREFIX,WSConstants.ENC_NS);
nsCtx.addNamespace(WSConstants.SIG_PREFIX,WSConstants.SIG_NS);
nsCtx.addNamespace(WSConstants.WSSE_PREFIX,WSConstants.WSSE_NS);
nsCtx.addNamespace(WSConstants.WSU_PREFIX,WSConstants.WSU_NS);
Iterator keys = namespaces.keySet().iterator();
while(keys.hasNext()){
String strPrefix = (String)keys.next();
String strNS = (String)namespaces.get(strPrefix);
nsCtx.addNamespace(strPrefix,strNS);
}
try {
for (String exp : expressions) {
XPath xp = new AXIOMXPath(exp);
xp.setNamespaceContext(nsCtx);
List list = xp.selectNodes(env);
for (Object aList : list) {
OMElement element = (OMElement) aList;
OMText text = (OMText) element.getFirstOMChild();
text.setOptimize(true);
}
}
} catch (JaxenException e) {
throw new RampartException("Error in XPath ", e);
}
}
代码示例来源:origin: usnistgov/iheos-toolkit2
t.setOptimize(use_mtom);
OMElement document = MetadataSupport.om_factory.createOMElement("Document", MetadataSupport.xdsB);
document.addAttribute("id", id, null);
内容来源于网络,如有侵权,请联系作者删除!