Method from org.apache.axiom.om.OMOutputFormat Detail: |
public boolean containsKey(String key) {
if (map == null) {
return false;
}
return map.containsKey(key);
}
|
public String getCharSetEncoding() {
return this.charSetEncoding;
}
Returns the character set encoding scheme. If the value of the charSetEncoding is not set
then the default will be returned. |
public String getContentType() {
String ct = null;
if (log.isDebugEnabled()) {
log.debug("Start getContentType: " + toString());
}
if (contentType == null) {
if (isSoap11) {
contentType = SOAP11Constants.SOAP_11_CONTENT_TYPE;
} else {
contentType = SOAP12Constants.SOAP_12_CONTENT_TYPE;
}
}
// If MTOM or SWA, the returned content-type is an
// appropriate multipart/related content type.
if (isOptimized()) {
if (isDoingSWA()) {
// If both optimized and SWA, then prefer SWA
// for the content type
ct = this.getContentTypeForSwA(contentType);
} else {
// Optimized without SWA is MTOM
ct = this.getContentTypeForMTOM(contentType);
}
} else if (isDoingSWA()) {
ct = this.getContentTypeForSwA(contentType);
} else {
ct = contentType;
}
if (log.isDebugEnabled()) {
log.debug("getContentType= {" + ct + "} " + toString());
}
return ct;
}
Return the content-type value that should be written with the message.
(i.e. if optimized, then a multipart/related content-type is returned). |
public String getContentTypeForMTOM(String SOAPContentType) {
// If an action was set, we need to include it within the value
// for the start-info attribute.
if (containsKey(ACTION_PROPERTY)) {
String action = (String) getProperty(ACTION_PROPERTY);
if (action != null && action.length() > 0) {
SOAPContentType = SOAPContentType + "; action=\\\"" + action + "\\\"";
}
}
StringBuffer sb = new StringBuffer();
sb.append("multipart/related");
sb.append("; ");
sb.append("boundary=");
sb.append(getMimeBoundary());
sb.append("; ");
sb.append("type=\"" + MTOMConstants.MTOM_TYPE + "\"");
sb.append("; ");
sb.append("start=\"< ").append(getRootContentId()).append(" >\"");
sb.append("; ");
sb.append("start-info=\"").append(SOAPContentType).append("\"");
return sb.toString();
}
Generates a Content-Type value for MTOM messages. This is a MIME Multipart/Related
Content-Type value as defined by RFC 2387 and the XOP specification. The generated
header will look like the following:
Content-Type: multipart/related; boundary=[MIME BOUNDARY VALUE];
type="application/xop+xml";
start="[MESSAGE CONTENT ID]";
start-info="[MESSAGE CONTENT TYPE]"; |
public String getContentTypeForSwA(String SOAPContentType) {
StringBuffer sb = new StringBuffer();
sb.append("multipart/related");
sb.append("; ");
sb.append("boundary=");
sb.append(getMimeBoundary());
sb.append("; ");
sb.append("type=\"").append(SOAPContentType).append("\"");
sb.append("; ");
sb.append("start=\"< ").append(getRootContentId()).append(" >\"");
return sb.toString();
}
|
public String getMimeBoundary() {
if (mimeBoundary == null) {
mimeBoundary =
"MIMEBoundary"
+ UUIDGenerator.getUUID().replace(':", '_");
}
return mimeBoundary;
}
|
public String getNextContentId() {
nextid++;
return nextid
+ "."
+ UUIDGenerator.getUUID()
+ "@apache.org";
}
|
public int getOptimizedThreshold() {
return optimizedThreshold;
}
|
public Object getProperty(String key) {
if (map == null) {
return null;
}
return map.get(key);
}
|
public String getRootContentId() {
if (rootContentId == null) {
rootContentId =
"0."
+ UUIDGenerator.getUUID()
+ "@apache.org";
}
return rootContentId;
}
|
public String getXmlVersion() {
return xmlVersion;
}
|
public boolean isAutoCloseWriter() {
return autoCloseWriter;
}
|
public boolean isDoingSWA() {
return doingSWA;
}
|
public boolean isIgnoreXMLDeclaration() {
return ignoreXMLDeclaration;
}
|
public boolean isOptimized() {
return doOptimize && !doingSWA; // optimize is disabled if SWA
}
|
public boolean isSOAP11() {
return isSoap11;
}
|
public void setAutoCloseWriter(boolean autoCloseWriter) {
this.autoCloseWriter = autoCloseWriter;
}
|
public void setCharSetEncoding(String charSetEncoding) {
this.charSetEncoding = charSetEncoding;
}
|
public void setContentType(String c) {
contentType = c;
}
Set a raw content-type
(i.e. "text/xml" (SOAP 1.1) or "application/xml" (REST))
If this method is not invoked, OMOutputFormat will choose
a content-type value consistent with the soap version. |
public void setDoOptimize(boolean b) {
doOptimize = b;
}
|
public void setDoingSWA(boolean doingSWA) {
this.doingSWA = doingSWA;
}
|
public void setIgnoreXMLDeclaration(boolean ignoreXMLDeclaration) {
this.ignoreXMLDeclaration = ignoreXMLDeclaration;
}
|
public void setMimeBoundary(String mimeBoundary) {
this.mimeBoundary = mimeBoundary;
}
|
public void setOptimizedThreshold(int optimizedThreshold) {
this.optimizedThreshold = optimizedThreshold;
}
|
public Object setProperty(String key,
Object value) {
if (map == null) {
map = new HashMap();
}
return map.put(key, value);
}
|
public void setRootContentId(String rootContentId) {
this.rootContentId = rootContentId;
}
|
public void setSOAP11(boolean b) {
isSoap11 = b;
}
|
public void setXmlVersion(String xmlVersion) {
this.xmlVersion = xmlVersion;
}
|
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("OMOutputFormat [");
sb.append(" mimeBoundary =");
sb.append(mimeBoundary);
sb.append(" rootContentId=");
sb.append(rootContentId);
sb.append(" doOptimize=");
sb.append(doOptimize);
sb.append(" doingSWA=");
sb.append(doingSWA);
sb.append(" isSOAP11=");
sb.append(isSoap11);
sb.append(" charSetEncoding=");
sb.append(charSetEncoding);
sb.append(" xmlVersion=");
sb.append(xmlVersion);
sb.append(" contentType=");
sb.append(contentType);
sb.append(" ignoreXmlDeclaration=");
sb.append(ignoreXMLDeclaration);
sb.append(" autoCloseWriter=");
sb.append(autoCloseWriter);
// TODO Print all properties
sb.append(" actionProperty=");
sb.append(getProperty(ACTION_PROPERTY));
sb.append(" optimizedThreshold=");
sb.append(optimizedThreshold);
sb.append("]");
return sb.toString();
}
Use toString for logging state of the OMOutputFormat |