Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/json/test/org/apache/axis2/json/gson/JSONXMLStreamAPITest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/json/test/org/apache/axis2/json/gson/JSONXMLStreamAPITest.java?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/json/test/org/apache/axis2/json/gson/JSONXMLStreamAPITest.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/json/test/org/apache/axis2/json/gson/JSONXMLStreamAPITest.java Sun Dec 17 21:35:47 2017 @@ -36,9 +36,7 @@ public class JSONXMLStreamAPITest { @Before public void setUp()throws Exception { - String baseDir = System.getProperty("basedir" , ".").toString(); -// UtilServer.start((baseDir + "target/repo"), (baseDir + "test-resources/json/conf/axis2_json.xml")); - UtilServer.start("target/repo", "test-conf/axis2_json.xml"); + UtilServer.start("target/repo", "test-repository/gson/axis2.xml"); } @@ -87,29 +85,17 @@ public class JSONXMLStreamAPITest { "{\"author\":\"Jhon_4\",\"numOfPages\":175,\"publisher\":\"Foxier\",\"reviewers\":[\"rev1\",\"rev2\"," + "\"rev3\"]}],\"staff\":50}}}"; - String actualResponse = post(echoLibrary, echoLibURL, contentType, charSet); + String actualResponse = UtilTest.post(echoLibrary, echoLibURL, contentType, charSet); Assert.assertNotNull(actualResponse); Assert.assertEquals(echoLibraryResponse , actualResponse); - String actualRespose_2 = post(getLibrary, getLibURL, contentType, charSet); + String actualRespose_2 = UtilTest.post(getLibrary, getLibURL, contentType, charSet); Assert.assertNotNull(actualRespose_2); Assert.assertEquals(getLibraryResponse, actualRespose_2); } - public String post(String jsonString, String strURL, String contentType, String charSet) - throws IOException { - PostMethod post = new PostMethod(strURL); - RequestEntity entity = new StringRequestEntity(jsonString, contentType, charSet); - post.setRequestEntity(entity); - HttpClient httpclient = new HttpClient(); - try { - int result = httpclient.executeMethod(post); - return post.getResponseBodyAsString(); - }finally { - post.releaseConnection(); - } - } + }
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/pom.xml?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/pom.xml (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/pom.xml Sun Dec 17 21:35:47 2017 @@ -96,6 +96,11 @@ <artifactId>xmlunit</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-javamail_1.4_spec</artifactId> + <scope>test</scope> + </dependency> </dependencies> <url>http://axis.apache.org/axis2/java/core/</url> <scm> Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java Sun Dec 17 21:35:47 2017 @@ -22,7 +22,6 @@ package org.apache.axis2.builder; import org.apache.axiom.attachments.Attachments; import org.apache.axiom.attachments.lifecycle.LifecycleManager; import org.apache.axiom.attachments.lifecycle.impl.LifecycleManagerImpl; -import org.apache.axiom.attachments.utils.IOUtils; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; @@ -60,6 +59,7 @@ import org.apache.axis2.util.JavaUtils; import org.apache.axis2.util.MessageProcessorSelector; import org.apache.axis2.util.MultipleEntryHashMap; import org.apache.axis2.wsdl.WSDLConstants; +import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.ws.commons.schema.XmlSchemaAll; @@ -193,6 +193,9 @@ public class BuilderUtil { } } } + }else { + throw new AxisFault(xmlSchemaElement.getName() + " message element in schema should follow the " + + "(Internationalized Resource Identifier)IRI ) style to process request in REST style"); } } } @@ -617,7 +620,7 @@ public class BuilderUtil { log.info("OMException in getSOAPBuilder", e); try { log.info("Remaining input stream :[" + - new String(IOUtils.getStreamAsByteArray(in), encoding) + "]"); + new String(IOUtils.toByteArray(in), encoding) + "]"); } catch (IOException e1) { // Nothing here? } @@ -638,7 +641,7 @@ public class BuilderUtil { log.info("OMException in getSOAPBuilder", e); try { log.info("Remaining input stream :[" + - new String(IOUtils.getStreamAsByteArray(inStream), charSetEnc) + "]"); + new String(IOUtils.toByteArray(inStream), charSetEnc) + "]"); } catch (IOException e1) { // Nothing here? } @@ -658,7 +661,7 @@ public class BuilderUtil { log.info("OMException in getSOAPBuilder", e); try { log.info("Remaining input stream :[" + - new String(IOUtils.getStreamAsByteArray(inStream)) + "]"); + new String(IOUtils.toByteArray(inStream)) + "]"); } catch (IOException e1) { // Nothing here? } @@ -679,7 +682,7 @@ public class BuilderUtil { log.info("OMException in getSOAPBuilder", e); try { log.info("Remaining input stream :[" + - new String(IOUtils.getStreamAsByteArray(inStream), charSetEnc) + "]"); + new String(IOUtils.toByteArray(inStream), charSetEnc) + "]"); } catch (IOException e1) { // Nothing here? } Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/builder/DataSourceBuilder.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/builder/DataSourceBuilder.java?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/builder/DataSourceBuilder.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/builder/DataSourceBuilder.java Sun Dec 17 21:35:47 2017 @@ -28,6 +28,7 @@ import javax.xml.stream.XMLStreamExcepti import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; +import org.apache.axiom.attachments.ByteArrayDataSource; import org.apache.axiom.attachments.impl.BufferUtils; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMDataSource; @@ -60,7 +61,7 @@ public class DataSourceBuilder implement return factory.createOMElement(ds, "dummy", ns); } - public class ByteArrayDataSourceEx extends javax.mail.util.ByteArrayDataSource implements OMDataSource { + public class ByteArrayDataSourceEx extends ByteArrayDataSource implements OMDataSource { private byte[] bytes; public ByteArrayDataSourceEx(byte[] bytes, String s) { Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/builder/MIMEBuilder.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/builder/MIMEBuilder.java?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/builder/MIMEBuilder.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/builder/MIMEBuilder.java Sun Dec 17 21:35:47 2017 @@ -20,6 +20,7 @@ package org.apache.axis2.builder; import org.apache.axiom.attachments.Attachments; +import org.apache.axiom.mime.ContentType; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axis2.AxisFault; @@ -27,9 +28,8 @@ import org.apache.axis2.Constants; import org.apache.axis2.context.MessageContext; import org.apache.axis2.util.MessageProcessorSelector; -import javax.mail.internet.ContentType; -import javax.mail.internet.ParseException; import java.io.InputStream; +import java.text.ParseException; public class MIMEBuilder implements Builder { Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/DeploymentClassLoader.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/DeploymentClassLoader.java?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/DeploymentClassLoader.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/DeploymentClassLoader.java Sun Dec 17 21:35:47 2017 @@ -19,9 +19,9 @@ package org.apache.axis2.deployment; -import org.apache.axiom.attachments.utils.IOUtils; import org.apache.axis2.classloader.BeanInfoCache; import org.apache.axis2.classloader.BeanInfoCachingClassLoader; +import org.apache.commons.io.IOUtils; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -122,7 +122,7 @@ public class DeploymentClassLoader exten entryName = entry.getName(); if (entryName != null && entryName.endsWith(resource)) { - byte[] raw = IOUtils.getStreamAsByteArray(zin); + byte[] raw = IOUtils.toByteArray(zin); return new URL("jar", "", -1, urls[0] + "!/" + libjar_name + "!/" + entryName, new ByteUrlStreamHandler(raw)); } @@ -160,7 +160,7 @@ public class DeploymentClassLoader exten entryName = entry.getName(); if (entryName != null && entryName.endsWith(resource)) { - byte[] raw = IOUtils.getStreamAsByteArray(zin); + byte[] raw = IOUtils.toByteArray(zin); resources.add(new URL("jar", "", -1, urls[0] + "!/" + libjar_name + "!/" + entryName, new ByteUrlStreamHandler(raw))); } @@ -209,7 +209,7 @@ public class DeploymentClassLoader exten entryName = entry.getName(); if (entryName != null && entryName.endsWith(resource)) { - byte[] raw = IOUtils.getStreamAsByteArray(zin); + byte[] raw = IOUtils.toByteArray(zin); zin.close(); return raw; } Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java Sun Dec 17 21:35:47 2017 @@ -138,9 +138,9 @@ public interface WSDL2Constants { // This was taken from thye resolution of CR117 (WSDL 2.0 working group) // http://www.w3.org/2002/ws/desc/5/cr-issues/issues.html?view=normal#CR117 // http://lists.w3.org/Archives/Public/www-ws-desc/2007Feb/0039.html - String LEGAL_CHARACTERS_IN_URL = "-._~!$&()*+,;=:@?/%"; - String LEGAL_CHARACTERS_IN_PATH = "-._~!$'()*+,;=:@"; - String LEGAL_CHARACTERS_IN_QUERY = "-._~!$'()*+,;=:@/?"; + String LEGAL_CHARACTERS_IN_URL = "-._~!$&()*,;=:@?/%"; + String LEGAL_CHARACTERS_IN_PATH = "-._~!$'()*,;=:@"; + String LEGAL_CHARACTERS_IN_QUERY = "-._~!$'()*,;=:@/?"; String TEMPLATE_ENCODE_ESCAPING_CHARACTER = "!"; public String MEP_URI_IN_ONLY = "http://www.w3.org/ns/wsdl/in-only"; Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/engine/DefaultObjectSupplier.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/engine/DefaultObjectSupplier.java?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/engine/DefaultObjectSupplier.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/engine/DefaultObjectSupplier.java Sun Dec 17 21:35:47 2017 @@ -20,6 +20,7 @@ package org.apache.axis2.engine; import java.lang.reflect.Modifier; +import java.lang.Enum; import org.apache.axis2.AxisFault; @@ -38,6 +39,14 @@ public class DefaultObjectSupplier imple // those classes have to be instantiated in a different way than a normal initialization. instance = clazz.getConstructor(new Class[] { parent }) .newInstance(new Object[] { getObject(parent) }); + } else if (clazz.isEnum()) { + // enum just can create a new instance, so we have to resort + // to a default value, obviously many options are possible. + try { + instance = Enum.valueOf(clazz, "NULL"); + } catch (IllegalArgumentException iae) { + throw AxisFault.makeFault(new Exception("Cannot create an enum object of type ("+clazz.getName()+") without a default value, please add a 'NULL' value to the enum that can be used as default.")); + } } else { instance = clazz.newInstance(); } Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/i18n/resource.properties URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/i18n/resource.properties?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/i18n/resource.properties (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/i18n/resource.properties Sun Dec 17 21:35:47 2017 @@ -88,7 +88,7 @@ unknownStyle=The {0} style is an unknown rawXmlProviderIsLimited=The XML provider supports only the methods that contain the public OMElement <method-name>(OMElement) signature where the method-name variable can be any value. methodNotImplemented=The implementation class does not define a method called methodDoesNotExistInOut=The ServiceClass object does not implement the required method in the following form: OMElement {0}(OMElement e) -methodDoesNotExistInOnly=RawXMLMessageReceiver can not handle this scenario since ServiceClass has implemented to take Non OMElement as method arguments. +methodDoesNotExistInOnly=RawInOnlyXMLMessageReceiver can not handle this scenario since ServiceClass has implemented to take Non OMElement as method arguments. implReturnedNull=The implementation class returned a null value. invalidMethodName=The {0} method name is not valid for the service implementation class. blockInvocationExpectsRes=The blocking invocation does not contain a response. Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/util/Utils.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/util/Utils.java?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/util/Utils.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/util/Utils.java Sun Dec 17 21:35:47 2017 @@ -20,23 +20,6 @@ package org.apache.axis2.util; -import java.io.File; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.net.SocketException; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.security.PrivilegedExceptionAction; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import javax.xml.namespace.QName; - import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFault; @@ -73,6 +56,22 @@ import org.apache.axis2.wsdl.WSDLConstan import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import javax.xml.namespace.QName; +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedExceptionAction; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + public class Utils { private static final Log log = LogFactory.getLog(Utils.class); @@ -804,4 +803,21 @@ public class Utils { return val != null && ((Boolean)val).booleanValue(); } } + + /** + * This method is used to find whether an axis2service is declared as hidden using the + * "hiddenService" param + * + * @param axisService - the service of interest + * @return true if is declared as hidden, false if not + */ + public static boolean isHiddenService(AxisService axisService) { + boolean hideService = false; + Parameter hiddenServiceParam; + hiddenServiceParam = axisService.getParameter(Constants.HIDDEN_SERVICE_PARAM_NAME); + if (hiddenServiceParam != null) { + hideService = !JavaUtils.isFalseExplicitly(hiddenServiceParam.getValue()); + } + return hideService; + } } Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/util/XMLPrettyPrinter.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/util/XMLPrettyPrinter.java?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/util/XMLPrettyPrinter.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/util/XMLPrettyPrinter.java Sun Dec 17 21:35:47 2017 @@ -19,8 +19,8 @@ package org.apache.axis2.util; -import org.apache.axiom.attachments.utils.IOUtils; import org.apache.axiom.om.OMElement; +import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -59,7 +59,7 @@ public class XMLPrettyPrinter { byte[] byteArray = null; try { FileInputStream fin = new FileInputStream(file); - byteArray = IOUtils.getStreamAsByteArray(fin); + byteArray = IOUtils.toByteArray(fin); fin.close(); inputStream = new ByteArrayInputStream(byteArray); outputStream = new FileOutputStream(file); Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/parent/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/parent/pom.xml?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/parent/pom.xml (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/parent/pom.xml Sun Dec 17 21:35:47 2017 @@ -1079,7 +1079,7 @@ </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> - <version>2.4.3</version> + <version>2.13</version> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java Sun Dec 17 21:35:47 2017 @@ -20,19 +20,18 @@ package org.apache.axis2.saaj; import org.apache.axiom.attachments.Attachments; +import org.apache.axiom.mime.ContentTypeBuilder; +import org.apache.axiom.mime.MediaType; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.om.impl.OMMultipartWriter; import org.apache.axiom.soap.SOAP11Version; -import org.apache.axiom.soap.SOAP12Version; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.util.UIDGenerator; import org.apache.axis2.saaj.util.SAAJUtil; import org.apache.axis2.transport.http.HTTPConstants; -import javax.mail.internet.ContentType; -import javax.mail.internet.ParseException; import javax.xml.soap.AttachmentPart; import javax.xml.soap.MimeHeader; import javax.xml.soap.MimeHeaders; @@ -46,6 +45,7 @@ import javax.xml.soap.SOAPPart; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.text.ParseException; import java.util.ArrayList; import java.util.Collection; import java.util.Hashtable; @@ -63,12 +63,7 @@ public class SOAPMessageImpl extends SOA public SOAPMessageImpl(SOAPEnvelopeImpl soapEnvelope) { this.mimeHeaders = new MimeHeaders(); - if (((SOAPFactory)soapEnvelope.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) { - this.mimeHeaders.addHeader("content-type", HTTPConstants.MEDIA_TYPE_TEXT_XML); - } else if (((SOAPFactory)soapEnvelope.omTarget.getOMFactory()).getSOAPVersion() == SOAP12Version.getSingleton()) { - this.mimeHeaders.addHeader("content-type", - HTTPConstants.MEDIA_TYPE_APPLICATION_SOAP_XML); - } + this.mimeHeaders.addHeader("content-type", ((SOAPFactory)soapEnvelope.omTarget.getOMFactory()).getSOAPVersion().getMediaType().toString()); soapPart = new SOAPPartImpl(this, soapEnvelope); } @@ -275,23 +270,20 @@ public class SOAPMessageImpl extends SOA public void saveChanges() throws SOAPException { try { String contentTypeValue = getSingleHeaderValue(HTTPConstants.HEADER_CONTENT_TYPE); - ContentType contentType = null; + ContentTypeBuilder contentType; if (isEmptyString(contentTypeValue)) { - if (attachmentParts.size() > 0) { - contentTypeValue = HTTPConstants.MEDIA_TYPE_MULTIPART_RELATED; - } else { - contentTypeValue = getBaseType(); + contentType = new ContentTypeBuilder(attachmentParts.size() > 0 ? MediaType.MULTIPART_RELATED : getMediaType()); + } else { + contentType = new ContentTypeBuilder(contentTypeValue); + //Use configures the baseType with multipart/related while no attachment exists or all the attachments are removed + if (contentType.getMediaType().equals(MediaType.MULTIPART_RELATED) && attachmentParts.size() == 0) { + contentType.setMediaType(getMediaType()); + contentType.clearParameters(); } } - contentType = new ContentType(contentTypeValue); - - //Use configures the baseType with multipart/related while no attachment exists or all the attachments are removed - if(contentType.getBaseType().equals(HTTPConstants.MEDIA_TYPE_MULTIPART_RELATED) && attachmentParts.size() == 0) { - contentType = new ContentType(getBaseType()); - } //If it is of multipart/related, initialize those required values in the content-type, including boundary etc. - if (contentType.getBaseType().equals(HTTPConstants.MEDIA_TYPE_MULTIPART_RELATED)) { + if (contentType.getMediaType().equals(MediaType.MULTIPART_RELATED)) { //Configure boundary String boundaryParam = contentType.getParameter("boundary"); @@ -315,15 +307,15 @@ public class SOAPMessageImpl extends SOA } //Configure type - contentType.setParameter("type", getBaseType()); + contentType.setParameter("type", getMediaType().toString()); //Configure charset String soapPartContentTypeValue = getSingleHeaderValue(soapPart.getMimeHeader(HTTPConstants.HEADER_CONTENT_TYPE)); - ContentType soapPartContentType = null; + ContentTypeBuilder soapPartContentType = null; if (isEmptyString(soapPartContentTypeValue)) { - soapPartContentType = new ContentType(soapPartContentTypeValue); + soapPartContentType = new ContentTypeBuilder(soapPartContentTypeValue); } else { - soapPartContentType = new ContentType(getBaseType()); + soapPartContentType = new ContentTypeBuilder(getMediaType()); } setCharsetParameter(soapPartContentType); } else { @@ -382,7 +374,7 @@ public class SOAPMessageImpl extends SOA if (attachmentParts.isEmpty()) { envelope.serialize(out, format); } else { - ContentType contentType = new ContentType(getSingleHeaderValue(HTTPConstants.HEADER_CONTENT_TYPE)); + ContentTypeBuilder contentType = new ContentTypeBuilder(getSingleHeaderValue(HTTPConstants.HEADER_CONTENT_TYPE)); String boundary = contentType.getParameter("boundary"); if(isEmptyString(boundary)) { boundary = UIDGenerator.generateMimeBoundary(); @@ -612,9 +604,8 @@ public class SOAPMessageImpl extends SOA } } - private String getBaseType() throws SOAPException { - boolean isSOAP12 = ((SOAPFactory)((SOAPEnvelopeImpl) soapPart.getEnvelope()).omTarget.getOMFactory()).getSOAPVersion() == SOAP12Version.getSingleton(); - return isSOAP12 ? HTTPConstants.MEDIA_TYPE_APPLICATION_SOAP_XML : HTTPConstants.MEDIA_TYPE_TEXT_XML; + private MediaType getMediaType() throws SOAPException { + return ((SOAPFactory)((SOAPEnvelopeImpl) soapPart.getEnvelope()).omTarget.getOMFactory()).getSOAPVersion().getMediaType(); } /** @@ -624,7 +615,7 @@ public class SOAPMessageImpl extends SOA * @param contentType * @throws SOAPException */ - private void setCharsetParameter(ContentType contentType) throws SOAPException{ + private void setCharsetParameter(ContentTypeBuilder contentType) throws SOAPException{ String charset = (String)getProperty(CHARACTER_SET_ENCODING); if (!isEmptyString(charset)) { contentType.setParameter("charset", charset); Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java Sun Dec 17 21:35:47 2017 @@ -20,6 +20,8 @@ package org.apache.axis2.saaj; import org.apache.axiom.attachments.Attachments; +import org.apache.axiom.mime.ContentType; +import org.apache.axiom.mime.MediaType; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMMetaFactory; import org.apache.axiom.om.impl.MTOMConstants; @@ -52,8 +54,6 @@ import org.w3c.dom.ProcessingInstruction import org.w3c.dom.Text; import org.w3c.dom.UserDataHandler; -import javax.mail.internet.ContentType; -import javax.mail.internet.ParseException; import javax.xml.soap.MimeHeaders; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; @@ -71,9 +71,11 @@ import javax.xml.transform.TransformerFa import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; + import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; +import java.text.ParseException; import java.util.Iterator; public class SOAPPartImpl extends SOAPPart { @@ -146,25 +148,29 @@ public class SOAPPartImpl extends SOAPPa soapFactory = metaFactory.getSOAP11Factory(); soapEnvelopeNamespaceURI = null; } else { - String baseType = contentType.getBaseType().toLowerCase(); - String soapContentType; - if (baseType.equals(MTOMConstants.MTOM_TYPE)) { + MediaType baseType = contentType.getMediaType(); + MediaType soapContentType; + if (baseType.equals(MediaType.APPLICATION_XOP_XML)) { isMTOM = true; String typeParam = contentType.getParameter("type"); if (typeParam == null) { throw new SOAPException("Missing 'type' parameter in XOP content type"); } else { - soapContentType = typeParam.toLowerCase(); + try { + soapContentType = new ContentType(typeParam).getMediaType(); + } catch (ParseException ex) { + throw new SOAPException("Failed to parse the 'type' parameter", ex); + } } } else { isMTOM = false; soapContentType = baseType; } - if (soapContentType.equals(HTTPConstants.MEDIA_TYPE_TEXT_XML)) { + if (soapContentType.equals(MediaType.TEXT_XML)) { soapEnvelopeNamespaceURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI; soapFactory = metaFactory.getSOAP11Factory(); - } else if (soapContentType.equals(HTTPConstants.MEDIA_TYPE_APPLICATION_SOAP_XML)) { + } else if (soapContentType.equals(MediaType.APPLICATION_SOAP_XML)) { soapEnvelopeNamespaceURI = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI; soapFactory = metaFactory.getSOAP12Factory(); } else { Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java Sun Dec 17 21:35:47 2017 @@ -20,7 +20,6 @@ package org.apache.axis2.saaj; import junit.framework.Assert; -import org.apache.axiom.attachments.utils.IOUtils; import org.apache.axiom.util.base64.Base64Utils; import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler; import org.apache.commons.httpclient.HttpClient; @@ -28,6 +27,7 @@ import org.apache.commons.httpclient.Htt import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.params.HttpMethodParams; +import org.apache.commons.io.IOUtils; import org.junit.Test; import org.junit.runner.RunWith; @@ -277,7 +277,7 @@ public class AttachmentTest extends Asse //Create InputStream from DataHandler's InputStream InputStream is = dh.getInputStream(); - byte buf[] = IOUtils.getStreamAsByteArray(is); + byte buf[] = IOUtils.toByteArray(is); //Setting Content via InputStream for image/jpeg mime type ByteArrayOutputStream bos = new ByteArrayOutputStream(); Base64Utils.encode(buf, 0, buf.length, bos); Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/SOAPMessageTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/SOAPMessageTest.java?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/SOAPMessageTest.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/SOAPMessageTest.java Sun Dec 17 21:35:47 2017 @@ -20,6 +20,9 @@ package org.apache.axis2.saaj; import junit.framework.Assert; + +import org.apache.axiom.mime.ContentType; +import org.apache.axiom.mime.MediaType; import org.apache.axis2.saaj.util.SAAJDataSource; import org.apache.axis2.transport.http.HTTPConstants; import org.junit.Before; @@ -27,7 +30,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import javax.activation.DataHandler; -import javax.mail.internet.ContentType; import javax.xml.namespace.QName; import javax.xml.soap.AttachmentPart; import javax.xml.soap.MessageFactory; @@ -46,6 +48,7 @@ import javax.xml.soap.SOAPHeaderElement; import javax.xml.soap.SOAPMessage; import javax.xml.soap.SOAPPart; import javax.xml.transform.stream.StreamSource; + import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -247,7 +250,7 @@ public class SOAPMessageTest extends Ass //start parameter is not checked, due to it is optional parameter, and seems RI will not add this value //assertNotNull("start parameter should exist in the content-type header", contentType.getParameter("start")); assertNotNull("type parameter should exist in the content-type header", contentType.getParameter("type")); - assertEquals(HTTPConstants.MEDIA_TYPE_MULTIPART_RELATED, contentType.getBaseType()); + assertEquals(MediaType.MULTIPART_RELATED, contentType.getMediaType()); } @Validated @Test @@ -266,7 +269,7 @@ public class SOAPMessageTest extends Ass msg2.saveChanges(); ContentType contentType2 = new ContentType(msg2.getMimeHeaders().getHeader(HTTPConstants.HEADER_CONTENT_TYPE)[0]); - assertEquals(contentType.getBaseType(), contentType2.getBaseType()); + assertEquals(contentType.getMediaType(), contentType2.getMediaType()); assertEquals(contentType.getParameter("boundary"), contentType2.getParameter("boundary")); assertEquals(contentType.getParameter("type"), contentType2.getParameter("type")); //start parameter is not checked, due to it is an optional parameter, and seems RI will not add this value @@ -284,14 +287,14 @@ public class SOAPMessageTest extends Ass assertNotNull(msg.getMimeHeaders().getHeader(HTTPConstants.HEADER_CONTENT_TYPE)); ContentType contentType = new ContentType(msg.getMimeHeaders().getHeader(HTTPConstants.HEADER_CONTENT_TYPE)[0]); - assertEquals(HTTPConstants.MEDIA_TYPE_MULTIPART_RELATED, contentType.getBaseType()); + assertEquals(MediaType.MULTIPART_RELATED, contentType.getMediaType()); msg.removeAllAttachments(); msg.saveChanges(); assertNotNull(msg.getMimeHeaders().getHeader(HTTPConstants.HEADER_CONTENT_TYPE)); contentType = new ContentType(msg.getMimeHeaders().getHeader(HTTPConstants.HEADER_CONTENT_TYPE)[0]); - assertEquals("text/xml", contentType.getBaseType()); + assertEquals(MediaType.TEXT_XML, contentType.getMediaType()); } private StringBuffer copyToBuffer(InputStream inputStream) { Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/tool/axis2-wsdl2code-maven-plugin/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/tool/axis2-wsdl2code-maven-plugin/pom.xml?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/tool/axis2-wsdl2code-maven-plugin/pom.xml (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/tool/axis2-wsdl2code-maven-plugin/pom.xml Sun Dec 17 21:35:47 2017 @@ -121,6 +121,9 @@ <fileset> <directory>src/test/test1/target</directory> </fileset> + <fileset> + <directory>src/test/test2/target</directory> + </fileset> </filesets> </configuration> </plugin> Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/tool/axis2-wsdl2code-maven-plugin/src/test/java/org/apache/axis2/maven2/wsdl2code/WSDL2CodeMojoTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/tool/axis2-wsdl2code-maven-plugin/src/test/java/org/apache/axis2/maven2/wsdl2code/WSDL2CodeMojoTest.java?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/tool/axis2-wsdl2code-maven-plugin/src/test/java/org/apache/axis2/maven2/wsdl2code/WSDL2CodeMojoTest.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/tool/axis2-wsdl2code-maven-plugin/src/test/java/org/apache/axis2/maven2/wsdl2code/WSDL2CodeMojoTest.java Sun Dec 17 21:35:47 2017 @@ -29,10 +29,16 @@ import java.util.HashSet; public class WSDL2CodeMojoTest extends AbstractMojoTestCase { /** Tests running the java generator. */ public void testJava() throws Exception { - runTest("src/test/test1", "wsdl2code"); + runTest("src/test/test1", "wsdl2code", "src/main/axis2/service.wsdl"); } - protected WSDL2CodeMojo newMojo(String pDir, String pGoal) throws Exception { + /** This test is added to test wsdl2codegen when there is schema import + * involved and the wsdl path contains space character */ + public void testSchemaImport() throws Exception { + runTest("src/test/test2", "wsdl2code", "src/main/axis2/test dir/service.wsdl"); + } + + protected WSDL2CodeMojo newMojo(String pDir, String pGoal, String baseFilePath) throws Exception { File baseDir = new File(new File(getBasedir()), pDir); File testPom = new File(baseDir, "pom.xml"); WSDL2CodeMojo mojo = (WSDL2CodeMojo)lookupMojo(pGoal, testPom); @@ -40,7 +46,7 @@ public class WSDL2CodeMojoTest extends A project.setDependencyArtifacts(new HashSet()); setVariableValueToObject(mojo, "project", project); setVariableValueToObject(mojo, "wsdlFile", - new File(baseDir, "src/main/axis2/service.wsdl").getAbsolutePath()); + new File(baseDir, baseFilePath).getAbsolutePath()); setVariableValueToObject(mojo, "outputDirectory", new File(baseDir, "target/generated-sources/axis2/wsdl2code")); setVariableValueToObject(mojo, "syncMode", "both"); @@ -51,8 +57,8 @@ public class WSDL2CodeMojoTest extends A return mojo; } - protected void runTest(String pDir, String pGoal) + protected void runTest(String pDir, String pGoal, String baseFilePath) throws Exception { - newMojo(pDir, pGoal).execute(); + newMojo(pDir, pGoal, baseFilePath).execute(); } } Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/format/TextMessageBuilderAdapter.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/format/TextMessageBuilderAdapter.java?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/format/TextMessageBuilderAdapter.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/format/TextMessageBuilderAdapter.java Sun Dec 17 21:35:47 2017 @@ -22,10 +22,9 @@ package org.apache.axis2.format; import java.io.InputStream; import java.io.Reader; import java.io.StringReader; +import java.text.ParseException; -import javax.mail.internet.ContentType; -import javax.mail.internet.ParseException; - +import org.apache.axiom.mime.ContentType; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/pom.xml?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/pom.xml (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/pom.xml Sun Dec 17 21:35:47 2017 @@ -114,10 +114,6 @@ <artifactId>commons-httpclient</artifactId> </dependency> <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - </dependency> - <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java Sun Dec 17 21:35:47 2017 @@ -20,6 +20,13 @@ package org.apache.axis2.transport.http; +import org.apache.axis2.AxisFault; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.description.AxisOperation; +import org.apache.axis2.description.AxisService; +import org.apache.axis2.engine.AxisConfiguration; +import org.apache.axis2.util.Utils; + import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -29,12 +36,6 @@ import java.util.Map; import java.util.Set; import java.util.TreeSet; -import org.apache.axis2.AxisFault; -import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.description.AxisOperation; -import org.apache.axis2.description.AxisService; -import org.apache.axis2.engine.AxisConfiguration; - /** * Class HTTPTransportReceiver @@ -113,23 +114,25 @@ public class HTTPTransportReceiver { AxisService axisService = (AxisService) it.next(); - Iterator iterator = axisService.getOperations(); + if (!Utils.isHiddenService(axisService)) { + Iterator iterator = axisService.getOperations(); - temp += "<h3><a href=\"" + axisService.getName() + "?wsdl\">" + - axisService.getName() + "</a></h3>"; + temp += "<h3><a href=\"" + axisService.getName() + "?wsdl\">" + + axisService.getName() + "</a></h3>"; - if (iterator.hasNext()) { - temp += "Available operations <ul>"; + if (iterator.hasNext()) { + temp += "Available operations <ul>"; - for (; iterator.hasNext();) { - AxisOperation axisOperation = (AxisOperation) iterator.next(); + for (; iterator.hasNext();) { + AxisOperation axisOperation = (AxisOperation) iterator.next(); - temp += "<li>" + axisOperation.getName().getLocalPart() + "</li>"; - } + temp += "<li>" + axisOperation.getName().getLocalPart() + "</li>"; + } - temp += "</ul>"; - } else { - temp += "No operations specified for this service"; + temp += "</ul>"; + } else { + temp += "No operations specified for this service"; + } } } } Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java Sun Dec 17 21:35:47 2017 @@ -413,19 +413,28 @@ public class HTTPSenderImpl extends HTTP // Process old style headers first Header[] cookieHeaders = method.getResponseHeaders(HTTPConstants.HEADER_SET_COOKIE); String customCoookiId = (String) msgContext.getProperty(Constants.CUSTOM_COOKIE_ID); - for (int i = 0; i < cookieHeaders.length; i++) { - HeaderElement[] elements = cookieHeaders[i].getElements(); - for (int e = 0; e < elements.length; e++) { - HeaderElement element = elements[e]; - if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName()) - || Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) { - sessionCookie = processCookieHeader(element); - } - if (customCoookiId != null && customCoookiId.equalsIgnoreCase(element.getName())) { - sessionCookie = processCookieHeader(element); - } - } - } + + // The following only check for JSESSIONID / axis_session / custom-cookie-id from the Set-Cookie header. + // But it will ignore if there are other Set-Cookie values, which may cause issues at client level, + // when invoking via a load-balancer, which expect some specific Cookie value. + // So the correct fix is to add whatever the value(s) in the Set-Cookie header as session cookie. + +// for (int i = 0; i < cookieHeaders.length; i++) { +// HeaderElement[] elements = cookieHeaders[i].getElements(); +// for (int e = 0; e < elements.length; e++) { +// HeaderElement element = elements[e]; +// if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName()) +// || Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) { +// sessionCookie = processCookieHeader(element); +// } +// if (customCoookiId != null && customCoookiId.equalsIgnoreCase(element.getName())) { +// sessionCookie = processCookieHeader(element); +// } +// } +// } + + sessionCookie = processSetCookieHeaders(cookieHeaders); + // Overwrite old style cookies with new style ones if present cookieHeaders = method.getResponseHeaders(HTTPConstants.HEADER_SET_COOKIE2); for (int i = 0; i < cookieHeaders.length; i++) { @@ -442,7 +451,7 @@ public class HTTPSenderImpl extends HTTP } } - if (sessionCookie != null) { + if (sessionCookie != null && !sessionCookie.equals("")) { msgContext.getServiceContext().setProperty(HTTPConstants.COOKIE_STRING, sessionCookie); } } @@ -456,6 +465,25 @@ public class HTTPSenderImpl extends HTTP } return cookie; } + + + private String processSetCookieHeaders(Header[] headers) { + String cookie = ""; + for (Header header : headers) { + if (!cookie.equals("")) { + cookie = cookie + ";"; + } + HeaderElement[] elements = header.getElements(); + for (HeaderElement element : elements) { + cookie = cookie + element.getName() + "=" + element.getValue(); + NameValuePair[] parameters = element.getParameters(); + for (NameValuePair parameter : parameters) { + cookie = cookie + "; " + parameter.getName() + "=" + parameter.getValue(); + } + } + } + return cookie; + } protected void processResponse(HttpMethodBase httpMethod, MessageContext msgContext) throws IOException { Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java Sun Dec 17 21:35:47 2017 @@ -433,19 +433,28 @@ public class HTTPSenderImpl extends HTTP // Process old style headers first Header[] cookieHeaders = response.getHeaders(HTTPConstants.HEADER_SET_COOKIE); String customCoookiId = (String) msgContext.getProperty(Constants.CUSTOM_COOKIE_ID); - for (int i = 0; i < cookieHeaders.length; i++) { - HeaderElement[] elements = cookieHeaders[i].getElements(); - for (int e = 0; e < elements.length; e++) { - HeaderElement element = elements[e]; - if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName()) - || Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) { - sessionCookie = processCookieHeader(element); - } - if (customCoookiId != null && customCoookiId.equalsIgnoreCase(element.getName())) { - sessionCookie = processCookieHeader(element); - } - } - } + + // The following only check for JSESSIONID / axis_session / custom-cookie-id from the Set-Cookie header. + // But it will ignore if there are other Set-Cookie values, which may cause issues at client level, + // when invoking via a load-balancer, which expect some specific Cookie value. + // So the correct fix is to add whatever the value(s) in the Set-Cookie header as session cookie. + +// for (int i = 0; i < cookieHeaders.length; i++) { +// HeaderElement[] elements = cookieHeaders[i].getElements(); +// for (int e = 0; e < elements.length; e++) { +// HeaderElement element = elements[e]; +// if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName()) +// || Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) { +// sessionCookie = processCookieHeader(element); +// } +// if (customCoookiId != null && customCoookiId.equalsIgnoreCase(element.getName())) { +// sessionCookie = processCookieHeader(element); +// } +// } +// } + + sessionCookie = processSetCookieHeaders(cookieHeaders); + // Overwrite old style cookies with new style ones if present cookieHeaders = response.getHeaders(HTTPConstants.HEADER_SET_COOKIE2); for (int i = 0; i < cookieHeaders.length; i++) { @@ -462,7 +471,7 @@ public class HTTPSenderImpl extends HTTP } } - if (sessionCookie != null) { + if (sessionCookie != null && !sessionCookie.equals("")) { msgContext.getServiceContext().setProperty(HTTPConstants.COOKIE_STRING, sessionCookie); } } @@ -476,6 +485,24 @@ public class HTTPSenderImpl extends HTTP } return cookie; } + + private String processSetCookieHeaders(Header[] headers) { + String cookie = ""; + for (Header header : headers) { + if (!cookie.equals("")) { + cookie = cookie + ";"; + } + HeaderElement[] elements = header.getElements(); + for (HeaderElement element : elements) { + cookie = cookie + element.getName() + "=" + element.getValue(); + NameValuePair[] parameters = element.getParameters(); + for (NameValuePair parameter : parameters) { + cookie = cookie + "; " + parameter.getName() + "=" + parameter.getValue(); + } + } + } + return cookie; + } protected void processResponse(HttpResponse response, MessageContext msgContext) throws IOException { Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/transport/jms/src/main/java/org/apache/axis2/transport/jms/JMSUtils.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/transport/jms/src/main/java/org/apache/axis2/transport/jms/JMSUtils.java?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/transport/jms/src/main/java/org/apache/axis2/transport/jms/JMSUtils.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/transport/jms/src/main/java/org/apache/axis2/transport/jms/JMSUtils.java Sun Dec 17 21:35:47 2017 @@ -15,6 +15,7 @@ */ package org.apache.axis2.transport.jms; +import org.apache.axiom.mime.ContentType; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; @@ -36,14 +37,13 @@ import org.apache.axis2.transport.jms.io import javax.jms.*; import javax.jms.Queue; -import javax.mail.internet.ContentType; -import javax.mail.internet.ParseException; import javax.naming.Context; import javax.naming.NamingException; import javax.naming.Reference; import javax.naming.NameNotFoundException; import java.lang.reflect.Method; +import java.text.ParseException; import java.util.*; /** Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/transport/testkit/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/transport/testkit/pom.xml?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/transport/testkit/pom.xml (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/transport/testkit/pom.xml Sun Dec 17 21:35:47 2017 @@ -83,6 +83,10 @@ <artifactId>jetty</artifactId> <version>5.1.10</version> </dependency> + <dependency> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-javamail_1.4_spec</artifactId> + </dependency> </dependencies> <profiles> Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/webapp/src/main/webapp/axis2-web/listServices.jsp URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/webapp/src/main/webapp/axis2-web/listServices.jsp?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/webapp/src/main/webapp/axis2-web/listServices.jsp (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/webapp/src/main/webapp/axis2-web/listServices.jsp Sun Dec 17 21:35:47 2017 @@ -22,6 +22,7 @@ <%@ page import="org.apache.axis2.description.AxisService" %> <%@ page import="org.apache.axis2.description.Parameter" %> <%@ page import="org.apache.axis2.engine.AxisConfiguration" %> +<%@ page import="org.apache.axis2.util.Utils" %> <%@ page import="org.apache.axis2.util.JavaUtils" %> <%@ page import="java.util.Collection" %> <%@ page import="java.util.Enumeration" %> @@ -56,6 +57,7 @@ // Collection operationsList; for (Iterator iterator = servicecol.iterator(); iterator.hasNext();) { AxisService axisService = (AxisService) iterator.next(); + if (!Utils.isHiddenService(axisService)) { opItr = axisService.getOperations(); //operationsList = operations.values(); serviceName = axisService.getName(); @@ -104,6 +106,7 @@ %></ul> <% status = true; + } } } if (errornessservice != null) { Modified: axis/axis2/java/core/branches/AXIS2-4091/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/pom.xml?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/pom.xml (original) +++ axis/axis2/java/core/branches/AXIS2-4091/pom.xml Sun Dec 17 21:35:47 2017 @@ -510,6 +510,13 @@ <email>sagara AT apache.org</email> <organization>WSO2</organization> </developer> + <developer> + <name>Shameera Rathnayaka</name> + <id>shameera</id> + <email>shameera AT apache.org</email> + <url>http://lk.linkedin.com/pub/shameera-rathnayaka/1a/661/561</url> + <organization>WSO2</organization> + </developer> </developers> <contributors> <contributor> Modified: axis/axis2/java/core/branches/AXIS2-4091/src/site/xdoc/docs/toc.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/src/site/xdoc/docs/toc.xml?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/src/site/xdoc/docs/toc.xml (original) +++ axis/axis2/java/core/branches/AXIS2-4091/src/site/xdoc/docs/toc.xml Sun Dec 17 21:35:47 2017 @@ -95,7 +95,12 @@ Guide</a></li> Transport sender</a></li> <li>18.2 <a href="servlet-transport.html">HTTP servlet transport</a></li> -<li>18.3 <a href="transport_howto.html">Custom +<li>18.3 <a href="jms-transport.html">JMS Transport</a></li> +<li>18.4 <a href="tcp-transport.html">TCP Transport</a></li> +<li>18.5 <a href="mail-transport.html">Mail Transport</a></li> +<li>18.6 <a href="udp-transport.html">UDP Transport</a></li> +<li>18.7 <a href="xmpp-transport.html">XMPP Transport</a></li> +<li>18.8 <a href="transport_howto.html">Custom Transport</a></li> </ul> </li> Modified: axis/axis2/java/core/branches/AXIS2-4091/src/site/xdoc/download.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/src/site/xdoc/download.xml?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/src/site/xdoc/download.xml (original) +++ axis/axis2/java/core/branches/AXIS2-4091/src/site/xdoc/download.xml Sun Dec 17 21:35:47 2017 @@ -105,7 +105,7 @@ <tr> <td><a name="1_6_1"/><strong>1.6.1</strong></td> <td>30 - Aug - 2011</td> - <td>1.6.1 Release (Mirrored)</td> + <td>1.6.1 Release (Archived)</td> <td> Binary Distribution <a href="http://archive.apache.org/dist/axis/axis2/java/core/1.6.1/axis2-1.6.1-bin.zip">zip</a> | Modified: axis/axis2/java/core/branches/AXIS2-4091/src/site/xdoc/tools/maven-plugins/maven-wsdl2code-plugin.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/src/site/xdoc/tools/maven-plugins/maven-wsdl2code-plugin.xml?rev=1818515&r1=1818514&r2=1818515&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/src/site/xdoc/tools/maven-plugins/maven-wsdl2code-plugin.xml (original) +++ axis/axis2/java/core/branches/AXIS2-4091/src/site/xdoc/tools/maven-plugins/maven-wsdl2code-plugin.xml Sun Dec 17 21:35:47 2017 @@ -47,19 +47,19 @@ POM</a> (Project Object Model):</p> <plugin> <groupId>org.apache.axis2</groupId> <artifactId>axis2-wsdl2code-maven-plugin</artifactId> - <version>1.4</version> + <version>1.6.2</version> <executions> <execution> <goals> <goal>wsdl2code</goal> </goals> - <configuration> - <packageName>com.foo.myservice</packageName> - <wsdlFile>src/main/wsdl/myservice.wsdl</wsdlFile> - <databindingName>xmlbeans</databindingName> - </configuration> </execution> </executions> + <configuration> + <packageName>com.foo.myservice</packageName> + <wsdlFile>src/main/wsdl/myservice.wsdl</wsdlFile> + <databindingName>xmlbeans</databindingName> + </configuration> </plugin> </plugins> </build> @@ -69,7 +69,7 @@ Also please add axis2 jars as a dependen <dependency> <groupId>org.apache.axis2</groupId> <artifactId>axis2</artifactId> - <version>1.4</version> + <version>1.6.2</version> </dependency> </pre> @@ -221,7 +221,7 @@ default, sources are generated for all s <td>${axis2.wsdl2code.unwrap}</td> <td>This will select between wrapped and unwrapped during code generation. Maps to the -uw option of the command line tool.</td> -<td>false</td> +<td>false</td> </tr> </tbody> </table>
