svn commit: r1377228 - in /axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2: classloader/ThreadContextDescriptor.java engine/DependencyManager.java receivers/AbstractMessageReceiver.java
Author: sagara Date: Sat Aug 25 07:24:03 2012 New Revision: 1377228 URL: http://svn.apache.org/viewvc?rev=1377228&view=rev Log: Fixed AXIS2-5399. Added: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/classloader/ThreadContextDescriptor.java (with props) Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/receivers/AbstractMessageReceiver.java Added: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/classloader/ThreadContextDescriptor.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/classloader/ThreadContextDescriptor.java?rev=1377228&view=auto == --- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/classloader/ThreadContextDescriptor.java (added) +++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/classloader/ThreadContextDescriptor.java Sat Aug 25 07:24:03 2012 @@ -0,0 +1,115 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.axis2.classloader; + +import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedAction; + +import org.apache.axis2.Constants; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.description.AxisService; + +public class ThreadContextDescriptor { + +private ClassLoader oldClassLoader; +private MessageContext oldMessageContext; + +public ClassLoader getOldClassLoader() { +return oldClassLoader; +} + +public void setOldClassLoader(ClassLoader oldClassLoader) { +this.oldClassLoader = oldClassLoader; +} + +public MessageContext getOldMessageContext() { +return oldMessageContext; +} + +public void setOldMessageContext(MessageContext oldMessageContext) { +this.oldMessageContext = oldMessageContext; +} + +public static ThreadContextDescriptor setThreadContext(final AxisService service) { +ThreadContextDescriptor tc = new ThreadContextDescriptor(); +tc.oldMessageContext = (MessageContext) MessageContext.currentMessageContext.get(); +final ClassLoader contextClassLoader = getContextClassLoader_doPriv(); +tc.oldClassLoader = contextClassLoader; +String serviceTCCL = (String) service.getParameterValue(Constants.SERVICE_TCCL); +if (serviceTCCL != null) { +serviceTCCL = serviceTCCL.trim().toLowerCase(); + +if (serviceTCCL.equals(Constants.TCCL_COMPOSITE)) { +final ClassLoader loader = (ClassLoader) AccessController +.doPrivileged(new PrivilegedAction() { +public Object run() { +return new MultiParentClassLoader(new URL[] {}, new ClassLoader[] { +service.getClassLoader(), contextClassLoader }); +} +}); +org.apache.axis2.java.security.AccessController +.doPrivileged(new PrivilegedAction() { +public Object run() { + Thread.currentThread().setContextClassLoader(loader); +return null; +} +}); +} else if (serviceTCCL.equals(Constants.TCCL_SERVICE)) { +org.apache.axis2.java.security.AccessController +.doPrivileged(new PrivilegedAction() { +public Object run() { +Thread.currentThread().setContextClassLoader( +service.getClassLoader()); +return null; +} +}); +} +} +return tc; +} + +/** + * Several pieces of information need to be available to the service + * implementation class. For one, the ThreadContextClassLoader needs to be + * correct, and for ano
svn commit: r1377230 - in /axis/axis2/java/rampart/trunk/modules/rampart-core/src: main/java/org/apache/rampart/ main/java/org/apache/rampart/util/ test/ test/java/ test/java/org/ test/java/org/apache
Author: veithen Date: Sat Aug 25 07:33:18 2012 New Revision: 1377230 URL: http://svn.apache.org/viewvc?rev=1377230&view=rev Log: RAMPART-358: Fixed the security fault detection code. Added: axis/axis2/java/rampart/trunk/modules/rampart-core/src/test/ axis/axis2/java/rampart/trunk/modules/rampart-core/src/test/java/ axis/axis2/java/rampart/trunk/modules/rampart-core/src/test/java/org/ axis/axis2/java/rampart/trunk/modules/rampart-core/src/test/java/org/apache/ axis/axis2/java/rampart/trunk/modules/rampart-core/src/test/java/org/apache/rampart/ axis/axis2/java/rampart/trunk/modules/rampart-core/src/test/java/org/apache/rampart/util/ axis/axis2/java/rampart/trunk/modules/rampart-core/src/test/java/org/apache/rampart/util/RampartUtilTest.java (with props) axis/axis2/java/rampart/trunk/modules/rampart-core/src/test/resources/ axis/axis2/java/rampart/trunk/modules/rampart-core/src/test/resources/org/ axis/axis2/java/rampart/trunk/modules/rampart-core/src/test/resources/org/apache/ axis/axis2/java/rampart/trunk/modules/rampart-core/src/test/resources/org/apache/rampart/ axis/axis2/java/rampart/trunk/modules/rampart-core/src/test/resources/org/apache/rampart/util/ axis/axis2/java/rampart/trunk/modules/rampart-core/src/test/resources/org/apache/rampart/util/soap11-invalid-fault.xml (with props) axis/axis2/java/rampart/trunk/modules/rampart-core/src/test/resources/org/apache/rampart/util/soap11-security-fault.xml (with props) axis/axis2/java/rampart/trunk/modules/rampart-core/src/test/resources/org/apache/rampart/util/soap12-security-fault.xml (with props) Modified: axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/util/RampartUtil.java Modified: axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java?rev=1377230&r1=1377229&r2=1377230&view=diff == --- axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java (original) +++ axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java Sat Aug 25 07:33:18 2012 @@ -16,13 +16,8 @@ package org.apache.rampart; -import org.apache.axiom.soap.SOAP11Constants; -import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFault; -import org.apache.axiom.soap.SOAPFaultCode; -import org.apache.axiom.soap.SOAPFaultSubCode; -import org.apache.axiom.soap.SOAPFaultValue; import org.apache.axiom.soap.SOAPHeader; import org.apache.axiom.soap.SOAPHeaderBlock; import org.apache.axis2.AxisFault; @@ -290,41 +285,7 @@ public class RampartEngine { private boolean isSecurityFault(RampartMessageData rmd) { - - SOAPEnvelope soapEnvelope = rmd.getMsgContext().getEnvelope(); - SOAPFault soapFault = soapEnvelope.getBody().getFault(); - - // This is not a soap fault - if (soapFault == null) { - return false; - } - - String soapVersionURI = rmd.getMsgContext().getEnvelope().getNamespace().getNamespaceURI(); - SOAPFaultCode faultCode = soapFault.getCode(); - if(faultCode == null){ - //If no fault code is given, then it can't be security fault - return false; - } - - if (soapVersionURI.equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)) { - // This is a fault processing the security header - if (faultCode.getTextAsQName().getNamespaceURI().equals(WSConstants.WSSE_NS)) { - return true; - } - } else if (soapVersionURI.equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) { - // TODO AXIOM API returns only one fault sub code, there can be many - SOAPFaultSubCode faultSubCode = faultCode.getSubCode(); - if (faultSubCode != null) { - SOAPFaultValue faultSubCodeValue = faultSubCode.getValue(); - - // This is a fault processing the security header - if (faultSubCodeValue != null && faultSubCodeValue.getTextAsQName(). - getNamespaceURI().equals(WSConstants.WSSE_NS)) { - return true; - } - } - } - - r
svn commit: r1377231 - in /axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http: CommonsHTTPTransportSender.java impl/httpclient3/HTTPClient3TransportSender.java impl/
Author: sagara Date: Sat Aug 25 07:53:19 2012 New Revision: 1377231 URL: http://svn.apache.org/viewvc?rev=1377231&view=rev Log: AXIS2-5390 - Add some comments to clarify usages. Modified: axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPClient3TransportSender.java axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPClient4TransportSender.java Modified: axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?rev=1377231&r1=1377230&r2=1377231&view=diff == --- axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java (original) +++ axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java Sat Aug 25 07:53:19 2012 @@ -50,6 +50,11 @@ import java.util.List; import java.util.Map; import java.util.zip.GZIPOutputStream; +/** + * The Class CommonsHTTPTransportSender use Commons-HTTPclient 3.1. Functionality + * of this class is identical to HTTPClient4TransportSender and users are highly + * encouraged to use HTTPClient4TransportSender instead of this. + */ public class CommonsHTTPTransportSender extends AbstractHandler implements HTTPTransportSender { /** * The {@link TransportOutDescription} object received by the call to Modified: axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPClient3TransportSender.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPClient3TransportSender.java?rev=1377231&r1=1377230&r2=1377231&view=diff == --- axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPClient3TransportSender.java (original) +++ axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPClient3TransportSender.java Sat Aug 25 07:53:19 2012 @@ -26,6 +26,10 @@ import org.apache.axis2.transport.http.C import org.apache.axis2.transport.http.HTTPTransportConstants; import org.apache.axis2.transport.http.HTTPTransportSender; +/** + * The Class HTTPClient4TransportSender use Commons-HTTPclient 3.1. Users are highly + * encouraged to use HTTPClient4TransportSender instead of CommonsHTTPTransportSender. + */ public class HTTPClient3TransportSender extends CommonsHTTPTransportSender implements HTTPTransportSender { Modified: axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPClient4TransportSender.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPClient4TransportSender.java?rev=1377231&r1=1377230&r2=1377231&view=diff == --- axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPClient4TransportSender.java (original) +++ axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPClient4TransportSender.java Sat Aug 25 07:53:19 2012 @@ -29,7 +29,9 @@ import org.apache.axis2.transport.http.H import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; - +/** + * The Class HTTPClient4TransportSender use HC HTTPClient 4.X. + */ public class HTTPClient4TransportSender extends CommonsHTTPTransportSender implements HTTPTransportSender {
svn commit: r1377239 - in /axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http: CommonsHTTPTransportSender.java impl/httpclient3/HTTPClient3TransportSender.java impl/
Author: sagara Date: Sat Aug 25 08:53:21 2012 New Revision: 1377239 URL: http://svn.apache.org/viewvc?rev=1377239&view=rev Log: Applied patch for AXIS2-5390. Modified: axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPClient3TransportSender.java axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPClient4TransportSender.java Modified: axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?rev=1377239&r1=1377238&r2=1377239&view=diff == --- axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java (original) +++ axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java Sat Aug 25 08:53:21 2012 @@ -376,9 +376,7 @@ public class CommonsHTTPTransportSender URL url = new URL(toEPR.getAddress()); // select the Message Sender depending on the REST status -AbstractHTTPSender sender; - -sender = new HTTPSenderImpl(); +AbstractHTTPSender sender = createHTTPSender(); boolean chunked; if (messageContext.getProperty(HTTPConstants.CHUNKED) != null) { @@ -411,6 +409,10 @@ public class CommonsHTTPTransportSender } } +protected AbstractHTTPSender createHTTPSender() { +return new HTTPSenderImpl(); +} + /** * @param actionString * @return true if the specified String represents a generated (anonymous name) Modified: axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPClient3TransportSender.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPClient3TransportSender.java?rev=1377239&r1=1377238&r2=1377239&view=diff == --- axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPClient3TransportSender.java (original) +++ axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPClient3TransportSender.java Sat Aug 25 08:53:21 2012 @@ -22,6 +22,7 @@ package org.apache.axis2.transport.http. import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; +import org.apache.axis2.transport.http.AbstractHTTPSender; import org.apache.axis2.transport.http.CommonsHTTPTransportSender; import org.apache.axis2.transport.http.HTTPTransportConstants; import org.apache.axis2.transport.http.HTTPTransportSender; @@ -43,4 +44,9 @@ public class HTTPClient3TransportSender super.cleanup(msgContext); } +@Override +protected AbstractHTTPSender createHTTPSender() { +return new HTTPSenderImpl(); +} + } Modified: axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPClient4TransportSender.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPClient4TransportSender.java?rev=1377239&r1=1377238&r2=1377239&view=diff == --- axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPClient4TransportSender.java (original) +++ axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPClient4TransportSender.java Sat Aug 25 08:53:21 2012 @@ -22,6 +22,7 @@ package org.apache.axis2.transport.http. import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; +import org.apache.axis2.transport.http.AbstractHTTPSender; import org.apache.axis2.transport.http.CommonsHTTPTransportSender; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.axis2.transport.http.HTTPTransportConstants; @@ -54,4 +55,9 @@ public class HTTPClient4TransportSender } +@Override +protected AbstractHTTPSender createHTTPSender() { +return new HTTPSenderImpl(); +} + }
svn commit: r1377324 - in /axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/impl: GsonNamespaceConext.java GsonXMLStreamWriter.java JsonFormatter.java utils/XmlNodeGenerator.java
Author: amilas Date: Sat Aug 25 16:59:39 2012 New Revision: 1377324 URL: http://svn.apache.org/viewvc?rev=1377324&view=rev Log: apply the patch for AXIS2-5400 Added: axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/impl/GsonNamespaceConext.java Modified: axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/impl/GsonXMLStreamWriter.java axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/impl/JsonFormatter.java axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/impl/utils/XmlNodeGenerator.java Added: axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/impl/GsonNamespaceConext.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/impl/GsonNamespaceConext.java?rev=1377324&view=auto == --- axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/impl/GsonNamespaceConext.java (added) +++ axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/impl/GsonNamespaceConext.java Sat Aug 25 16:59:39 2012 @@ -0,0 +1,35 @@ +/* + * Copyright 2004,2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.axis2.json.impl; + +import javax.xml.namespace.NamespaceContext; +import java.util.Iterator; + +public class GsonNamespaceConext implements NamespaceContext { + +public String getNamespaceURI(String prefix) { +return null; +} + +public String getPrefix(String namespaceURI) { +return null; +} + +public Iterator getPrefixes(String namespaceURI) { +return null; +} +} Modified: axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/impl/GsonXMLStreamWriter.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/impl/GsonXMLStreamWriter.java?rev=1377324&r1=1377323&r2=1377324&view=diff == --- axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/impl/GsonXMLStreamWriter.java (original) +++ axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/impl/GsonXMLStreamWriter.java Sat Aug 25 16:59:39 2012 @@ -300,7 +300,7 @@ public class GsonXMLStreamWriter impleme */ public void writeStartElement(String namespaceURI, String localName) throws XMLStreamException { -throw new UnsupportedOperationException("Method is not implemented"); +writeStartElement(localName); } /** @@ -532,7 +532,7 @@ public class GsonXMLStreamWriter impleme */ public void writeDefaultNamespace(String namespaceURI) throws XMLStreamException { -throw new UnsupportedOperationException("Method is not implemented"); +// do nothing } /** @@ -752,7 +752,7 @@ public class GsonXMLStreamWriter impleme */ public void setDefaultNamespace(String uri) throws XMLStreamException { -throw new UnsupportedOperationException("Method is not implemented"); +//do nothing. } /** @@ -783,7 +783,7 @@ public class GsonXMLStreamWriter impleme */ public NamespaceContext getNamespaceContext() { -return null; +return new GsonNamespaceConext(); } /** Modified: axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/impl/JsonFormatter.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/impl/JsonFormatter.java?rev=1377324&r1=1377323&r2=1377324&view=diff == --- axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/impl/JsonFormatter.java (original) +++ axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/impl/JsonFormatter.java Sat Aug 25 16:59:39 2012 @@ -101,7 +101,7 @@ public class JsonFormatter implements Me } xmlsw.writeEndDocument(); } catch (XMLStreamException e) { -throw new AxisFault("Error while writing to the output stream using JsonWriter"); +throw new AxisFault("Error while writing to the output stream using JsonWriter", e); } } else { Modified: axis/axis2/java/core/trunk/modules/json/src/org/apache/axi