Author: alessio.soldano(a)jboss.com
Date: 2010-12-22 05:12:23 -0500 (Wed, 22 Dec 2010)
New Revision: 13525
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/fastinfoset/FastInfosetTestCase.java
Log:
[JBWS-3192] Set application/fastinfoset content-type on request messages when
FastInfosetFeature is on
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2010-12-21
13:51:31 UTC (rev 13524)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2010-12-22
10:12:23 UTC (rev 13525)
@@ -59,6 +59,7 @@
import org.jboss.ws.core.soap.attachment.MultipartRelatedSwAEncoder;
import org.jboss.ws.core.soap.attachment.MultipartRelatedXOPEncoder;
import org.jboss.ws.extensions.xop.XOPContext;
+import org.jboss.ws.feature.FastInfosetFeature;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.w3c.dom.Node;
@@ -299,10 +300,9 @@
return new MimeMatchingAttachmentsIterator(headers, attachments);
}
- private String getSOAPContentType() throws SOAPException
+ private String getSOAPContentType(CommonMessageContext msgContext) throws
SOAPException
{
//Check binding type in the endpoint metadata
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext != null &&
Constants.SOAP12HTTP_BINDING.equalsIgnoreCase(msgContext.getEndpointMetaData().getBindingId()))
{
return SOAPConstants.SOAP_1_2_CONTENT_TYPE;
@@ -329,7 +329,8 @@
throw new IllegalStateException("XOP parameter not properly
inlined");
// default content-type
- String contentType = getSOAPContentType() + "; charset=" +
getCharSetEncoding();
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ String contentType = getSOAPContentType(msgContext) + "; charset="
+ getCharSetEncoding();
if (hasAttachments)
{
@@ -346,6 +347,10 @@
contentType = multipartRelatedEncoder.getContentType();
}
}
+ else if (msgContext != null &&
msgContext.getEndpointMetaData().getFeatures().isFeatureEnabled(FastInfosetFeature.class))
+ {
+ contentType = MimeConstants.TYPE_FASTINFOSET;
+ }
//JBWS-2964:Create a new mimeHeaders to avoid changing another referenced
mimeHeaders
MimeHeaders newMimeHeaders = new MimeHeaders();
Iterator iterator = mimeHeaders.getAllHeaders();
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/fastinfoset/FastInfosetTestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/fastinfoset/FastInfosetTestCase.java 2010-12-21
13:51:31 UTC (rev 13524)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/fastinfoset/FastInfosetTestCase.java 2010-12-22
10:12:23 UTC (rev 13525)
@@ -32,6 +32,7 @@
import junit.framework.Test;
+import org.jboss.ws.core.soap.attachment.MimeConstants;
import org.jboss.ws.feature.FastInfosetFeature;
import org.jboss.wsf.common.DOMUtils;
import org.jboss.wsf.test.JBossWSTest;
@@ -79,6 +80,7 @@
int resCode = con.getResponseCode();
assertEquals(200, resCode);
+ assertEquals(MimeConstants.TYPE_FASTINFOSET, con.getContentType());
}
public void testRoundTrip() throws Exception
Show replies by date