You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by sc...@apache.org on 2007/09/14 00:06:59 UTC

svn commit: r575483 - /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java

Author: scheu
Date: Thu Sep 13 15:06:59 2007
New Revision: 575483

URL: http://svn.apache.org/viewvc?rev=575483&view=rev
Log:
WSCOMMONS-252
Contributor:Nicholas L Gallardo
Expose setContentType method on OMOutputFormat.

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java?rev=575483&r1=575482&r2=575483&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java Thu Sep 13 15:06:59 2007
@@ -45,6 +45,7 @@
 
     private String charSetEncoding;
     private String xmlVersion;
+    private String contentType;
     private boolean ignoreXMLDeclaration = false;
     private boolean autoCloseWriter = false;
 
@@ -56,21 +57,40 @@
         return doOptimize;
     }
 
+    /**
+     * Return the content-type value that should be written with the message.
+     * (i.e. if optimized, then a multipart/related content-type is returned).
+     * @return content-type value
+     */
     public String getContentType() {
-        String soapContentType;
-        if (isSoap11) {
-            soapContentType = SOAP11Constants.SOAP_11_CONTENT_TYPE;
-        } else {
-            soapContentType = SOAP12Constants.SOAP_12_CONTENT_TYPE;
+       
+        if (contentType == null) {
+            if (isSoap11) {
+                contentType = SOAP11Constants.SOAP_11_CONTENT_TYPE;
+            } else {
+                contentType = SOAP12Constants.SOAP_12_CONTENT_TYPE;
+            }
         }
-        // MTOM is given priority
+        // If MTOM or SWA, the returned content-type is an 
+        // appropriate multipart/related content type.
         if (isOptimized()) {
-            return this.getContentTypeForMTOM(soapContentType);
+            return this.getContentTypeForMTOM(contentType);
         } else if (isDoingSWA()) {
-            return this.getContentTypeForSwA(soapContentType);
+            return this.getContentTypeForSwA(contentType);
         } else {
-            return soapContentType;
+            return contentType;
         }
+    }
+    
+    /**
+     * 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.
+     * @param c
+     */
+    public void setContentType(String c) {
+        contentType = c;
     }
 
     public String getMimeBoundary() {



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org