You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by gd...@apache.org on 2007/06/16 16:21:10 UTC
svn commit: r547926 - in /webservices/axis2/trunk/java/modules:
adb/src/org/apache/axis2/rpc/receivers/ kernel/src/org/apache/axis2/
kernel/src/org/apache/axis2/addressing/ kernel/src/org/apache/axis2/context/
kernel/src/org/apache/axis2/deployment/ ke...
Author: gdaniels
Date: Sat Jun 16 07:21:09 2007
New Revision: 547926
URL: http://svn.apache.org/viewvc?view=rev&rev=547926
Log:
* First part of fix for https://issues.apache.org/jira/browse/AXIS2-2642 (still need to add getEngagedModules to AxisDescription)
* Throw the real error in RPCInOnlyMessageReceiver
* A little prep work for better fault handling flow in AxisEngine (still on the drawing board)
* General cleanups, JavaDoc improvements
Modified:
webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOnlyMessageReceiver.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/OperationContext.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/ListenerManager.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpService.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java
Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOnlyMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOnlyMessageReceiver.java?view=diff&rev=547926&r1=547925&r2=547926
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOnlyMessageReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOnlyMessageReceiver.java Sat Jun 16 07:21:09 2007
@@ -88,22 +88,18 @@
}
} catch (InvocationTargetException e) {
- String msg = null;
-
Throwable cause = e.getCause();
-
if (cause != null) {
- msg = cause.getMessage();
+ String msg = cause.getMessage();
if (msg == null) {
msg = "Exception occurred while trying to invoke service method " +
method.getName();
}
- log.error(msg, e);
- if (cause instanceof AxisFault) {
- throw (AxisFault)cause;
- }
+ log.error(msg, cause);
+ } else {
+ cause = e;
}
- throw new AxisFault(msg, e);
+ throw AxisFault.makeFault(cause);
} catch (Exception e) {
String msg = "Exception occurred while trying to invoke service method " +
method.getName();
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java?view=diff&rev=547926&r1=547925&r2=547926
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java Sat Jun 16 07:21:09 2007
@@ -269,7 +269,6 @@
public static final String HTTP_METHOD_POST = "POST";
public static final String CONTENT_TYPE = "ContentType";
- public static final String CONTENT_TYPE_OF_FAULT = "ContentTypeOfFault";
public static final String CONFIG_CONTEXT_TIMOUT_INTERVAL = "ConfigContextTimeoutInterval";
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java?view=diff&rev=547926&r1=547925&r2=547926
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java Sat Jun 16 07:21:09 2007
@@ -88,6 +88,7 @@
// fault informatio to send the error. Try to send using replyTo, leave it to transport
boolean doNotSendFaultUsingFaultTo = false;
if (faultInfoForHeaders != null) {
+ // TODO: This should probably store a QName instead of a String.. currently we rely on prefix string matching!!
String problemHeaderName = (String) ((Map) faultInfoForHeaders)
.get(AddressingConstants.Final.FAULT_HEADER_PROB_HEADER_QNAME);
doNotSendFaultUsingFaultTo = (problemHeaderName != null && (AddressingConstants
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java?view=diff&rev=547926&r1=547925&r2=547926
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java Sat Jun 16 07:21:09 2007
@@ -44,6 +44,7 @@
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.engine.Handler;
import org.apache.axis2.engine.Phase;
+import org.apache.axis2.engine.AxisError;
import org.apache.axis2.util.LoggingControl;
import org.apache.axis2.util.MetaDataEntry;
import org.apache.axis2.util.ObjectStateUtils;
@@ -1287,8 +1288,12 @@
this.setParent(operationContext);
if (operationContext != null) {
- if ((serviceContext != null) && (operationContext.getParent() == null)) {
- operationContext.setParent(serviceContext);
+ if (serviceContext == null) {
+ setServiceContext(operationContext.getServiceContext());
+ } else {
+ if (operationContext.getParent() != serviceContext) {
+ throw new AxisError("ServiceContext in OperationContext does not match !");
+ }
}
this.setAxisOperation(operationContext.getAxisOperation());
@@ -1354,8 +1359,8 @@
if (serviceContext != null) {
if ((operationContext != null)
- && (operationContext.getParent() != null)) {
- operationContext.setParent(context);
+ && (operationContext.getParent() != context)) {
+ throw new AxisError("ServiceContext and OperationContext.parent do not match!");
}
// setting configcontext using configuration context in service context
if (configurationContext == null) {
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/OperationContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/OperationContext.java?view=diff&rev=547926&r1=547925&r2=547926
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/OperationContext.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/OperationContext.java Sat Jun 16 07:21:09 2007
@@ -171,7 +171,7 @@
//----------------------------------------------------------------
/**
- * Simple constructor
+ * Simple constructor (needed for deserialization, shouldn't be used otherwise!)
*/
public OperationContext() {
super(null);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java?view=diff&rev=547926&r1=547925&r2=547926
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java Sat Jun 16 07:21:09 2007
@@ -305,12 +305,11 @@
* Update the list of modules that is required to be engaged globally.
*/
protected void processModuleRefs(Iterator moduleRefs, AxisConfiguration config) {
- List globalModules = config.getGlobalModules();
while (moduleRefs.hasNext()) {
OMElement moduleref = (OMElement) moduleRefs.next();
OMAttribute moduleRefAttribute = moduleref.getAttribute(new QName(TAG_REFERENCE));
String refName = moduleRefAttribute.getAttributeValue();
- globalModules.add(refName);
+ axisConfig.addGlobalModuleRef(refName);
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java?view=diff&rev=547926&r1=547925&r2=547926
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java Sat Jun 16 07:21:09 2007
@@ -554,10 +554,7 @@
* @throws org.apache.axis2.AxisFault : If smt goes wrong
*/
public void engageModules() throws AxisFault {
- for (Iterator iterator = axisConfig.getGlobalModules().iterator(); iterator.hasNext();) {
- String name = (String) iterator.next();
- axisConfig.engageModule(name);
- }
+ axisConfig.engageGlobalModules();
}
/**
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java?view=diff&rev=547926&r1=547925&r2=547926
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java Sat Jun 16 07:21:09 2007
@@ -503,7 +503,8 @@
* @param parent <code>ParameterInclude</code>
*/
protected void processParameters(Iterator parameters,
- ParameterInclude parameterInclude, ParameterInclude parent)
+ ParameterInclude parameterInclude,
+ ParameterInclude parent)
throws DeploymentException {
while (parameters.hasNext()) {
// this is to check whether some one has locked the parmeter at the
@@ -513,8 +514,7 @@
// setting parameterElement
parameter.setParameterElement(parameterElement);
// setting parameter Name
- OMAttribute paramName = parameterElement.getAttribute(new QName(
- ATTRIBUTE_NAME));
+ OMAttribute paramName = parameterElement.getAttribute(new QName(ATTRIBUTE_NAME));
if (paramName == null) {
throw new DeploymentException(Messages.getMessage(
DeploymentErrorMsgs.BAD_PARAMETER_ARGUMENT,
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java?view=diff&rev=547926&r1=547925&r2=547926
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java Sat Jun 16 07:21:09 2007
@@ -30,6 +30,7 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Collection;
public abstract class AxisDescription implements ParameterInclude,
DescriptionConstants {
@@ -399,16 +400,11 @@
*/
public abstract void engageModule(AxisModule axisModule) throws AxisFault;
-// /**
-// * @deprecate Please use String version instead
-// * @param moduleName
-// * @return
-// */
-// public abstract boolean isEngaged(QName moduleName);
-
public abstract boolean isEngaged(String moduleName);
- private Policy getApplicablePolicy(AxisDescription axisDescription) {
+// public Collection getEngagedModules() { return null; }
+
+ private Policy getApplicablePolicy(AxisDescription axisDescription) {
if (axisDescription instanceof AxisOperation) {
AxisOperation operation = (AxisOperation) axisDescription;
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java?view=diff&rev=547926&r1=547925&r2=547926
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java Sat Jun 16 07:21:09 2007
@@ -235,7 +235,8 @@
}
if (uniqueMethods.get(getSimpleName(jMethod)) != null) {
- log.warn("We don't support methods overloading. Ignoring [" + jMethod.getQualifiedName() + "]");
+ log.warn("We don't support method overloading. Ignoring [" +
+ jMethod.getQualifiedName() + "]");
continue;
}
@@ -427,11 +428,10 @@
eltOuter.getQName());
- JClass tempClass = javaType;
Set propertiesSet = new HashSet();
Set propertiesNames = new HashSet();
- JProperty[] tempProperties = tempClass.getDeclaredProperties();
+ JProperty[] tempProperties = javaType.getDeclaredProperties();
for (int i = 0; i < tempProperties.length; i++) {
propertiesSet.add(tempProperties[i]);
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java?view=diff&rev=547926&r1=547925&r2=547926
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java Sat Jun 16 07:21:09 2007
@@ -52,12 +52,8 @@
*/
private HashMap dataLocators = new HashMap();
private HashMap dataLocatorClassNames = new HashMap();
- /**
- * Field modules
- */
- // private final HashMap defaultModules = new HashMap();
- //
- // To store all the available modules (including version)
+
+ /** This is a Map of String name -> AxisModule for all available Modules. */
private final HashMap allModules = new HashMap();
// To store mapping between default version and module name
@@ -91,7 +87,7 @@
/**
* Field engagedModules
*/
- private final List engagedModules;
+ private final ArrayList engagedModules;
private Hashtable faultyModules;
@@ -295,8 +291,7 @@
}
Iterator enModule = engagedModules.iterator();
while (enModule.hasNext()) {
- String moduleName = (String) enModule.next();
- axisServiceGroup.engageModule(getModule(moduleName));
+ axisServiceGroup.engageModule((AxisModule)enModule.next());
}
services = axisServiceGroup.getServices();
while (services.hasNext()) {
@@ -430,11 +425,10 @@
boolean isEngagable;
if (module != null) {
String moduleName = module.getName();
- for (Iterator iterator = engagedModules.iterator(); iterator
- .hasNext();) {
- String thisModule = (String) iterator.next();
+ for (Iterator iterator = engagedModules.iterator(); iterator.hasNext();) {
+ AxisModule thisModule = (AxisModule)iterator.next();
- isEngagable = Utils.checkVersion(moduleName, thisModule);
+ isEngagable = Utils.checkVersion(moduleName, thisModule.getName());
if (!isEngagable) {
return;
}
@@ -448,7 +442,7 @@
.next();
serviceGroup.engageModule(module);
}
- engagedModules.add(module.getName());
+ engagedModules.add(module);
}
/**
@@ -472,7 +466,7 @@
.next();
axisServiceGroup.removeFromEngageList(module.getName());
}
- engagedModules.remove(module.getName());
+ engagedModules.remove(module);
}
}
@@ -539,16 +533,29 @@
}
/**
- * Method getEngagedModules.
+ * getEngagedModules() returns a copy of the list of engaged modules
*
- * @return Collection
+ * @return Collection a collection, containing AxisModules
*/
public Collection getEngagedModules() {
- return engagedModules;
+ return (Collection)engagedModules.clone();
+ }
+
+ /**
+ * Add an AxisModule to the list of globally deployed modules.
+ *
+ * TODO: should this check for duplicate names?
+ *
+ * @param module name of AxisModule to add to list.
+ */
+ public void addGlobalModuleRef(String moduleName) {
+ globalModuleList.add(moduleName);
}
- public List getGlobalModules() {
- return globalModuleList;
+ public void engageGlobalModules() throws AxisFault {
+ for (Iterator i = globalModuleList.iterator(); i.hasNext();) {
+ engageModule((String)i.next());
+ }
}
public Hashtable getFaultyModules() {
@@ -779,10 +786,12 @@
}
public boolean isEngaged(String moduleName) {
+ AxisModule module = (AxisModule)allModules.get(moduleName);
+ if (module == null) return false;
boolean isEngaged = engagedModules.contains(moduleName);
- AxisModule defaultModule = getDefaultModule(moduleName);
- if (!isEngaged && defaultModule != null) {
- isEngaged = engagedModules.contains(defaultModule.getName());
+ if (!isEngaged) {
+ AxisModule defaultModule = getDefaultModule(moduleName);
+ isEngaged = engagedModules.contains(defaultModule);
}
return isEngaged;
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java?view=diff&rev=547926&r1=547925&r2=547926
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java Sat Jun 16 07:21:09 2007
@@ -20,9 +20,7 @@
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPHeaderBlock;
import org.apache.axis2.AxisFault;
-import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.axis2.client.async.Callback;
-import org.apache.axis2.client.async.AsyncResult;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.OperationContext;
@@ -54,8 +52,6 @@
private static boolean RESUMING_EXECUTION = true;
private static boolean NOT_RESUMING_EXECUTION = false;
- private static boolean IS_INBOUND = true;
- private static boolean IS_OUTBOUND = false;
/**
* Constructor AxisEngine
@@ -117,7 +113,7 @@
}
ConfigurationContext confContext = msgContext.getConfigurationContext();
ArrayList preCalculatedPhases;
- if (msgContext.isFault()|| msgContext.isProcessingFault()) {
+ if (msgContext.isFault() || msgContext.isProcessingFault()) {
preCalculatedPhases = confContext.getAxisConfiguration().getInFaultFlowPhases();
msgContext.setFLOW(MessageContext.IN_FAULT_FLOW);
} else {
@@ -129,7 +125,7 @@
// affecting later messages.
msgContext.setExecutionChain((ArrayList) preCalculatedPhases.clone());
try {
- InvocationResponse pi = invoke(msgContext, IS_INBOUND, NOT_RESUMING_EXECUTION);
+ InvocationResponse pi = invoke(msgContext, NOT_RESUMING_EXECUTION);
if (pi.equals(InvocationResponse.CONTINUE)) {
if (msgContext.isServerSide()) {
@@ -165,6 +161,17 @@
return InvocationResponse.CONTINUE;
}
+ private static void processFault(MessageContext msgContext, AxisFault e) {
+ try {
+ MessageContext faultMC = MessageContextBuilder.createFaultMessageContext(msgContext, e);
+
+ // Figure out where this goes
+ sendFault(faultMC);
+ } catch (AxisFault axisFault) {
+ log.error(axisFault);
+ }
+ }
+
/**
* Take the execution chain from the msgContext , and then take the current Index
* and invoke all the phases in the arraylist
@@ -175,7 +182,7 @@
* the next step in the message processing should be.
* @throws AxisFault
*/
- public static InvocationResponse invoke(MessageContext msgContext, boolean inbound, boolean resuming)
+ private static InvocationResponse invoke(MessageContext msgContext, boolean resuming)
throws AxisFault {
if (msgContext.getCurrentHandlerIndex() == -1) {
@@ -261,7 +268,7 @@
//the point at which the message was resumed and provide another API
//to allow the full unwind if the message is going to be discarded.
//invoke the phases
- InvocationResponse pi = invoke(msgContext, IS_INBOUND, RESUMING_EXECUTION);
+ InvocationResponse pi = invoke(msgContext, RESUMING_EXECUTION);
//invoking the MR
if (pi.equals(InvocationResponse.CONTINUE)) {
@@ -303,7 +310,7 @@
//the point at which the message was resumed and provide another API
//to allow the full unwind if the message is going to be discarded.
//invoke the phases
- InvocationResponse pi = invoke(msgContext, IS_OUTBOUND, RESUMING_EXECUTION);
+ InvocationResponse pi = invoke(msgContext, RESUMING_EXECUTION);
//Invoking Transport Sender
if (pi.equals(InvocationResponse.CONTINUE)) {
// write the Message to the Wire
@@ -363,7 +370,7 @@
msgContext.setExecutionChain(outPhases);
msgContext.setFLOW(MessageContext.OUT_FLOW);
try {
- InvocationResponse pi = invoke(msgContext, IS_OUTBOUND, NOT_RESUMING_EXECUTION);
+ InvocationResponse pi = invoke(msgContext, NOT_RESUMING_EXECUTION);
if (pi.equals(InvocationResponse.CONTINUE)) {
// write the Message to the Wire
@@ -428,7 +435,7 @@
msgContext.setExecutionChain((ArrayList) outFaultPhases.clone());
msgContext.setFLOW(MessageContext.OUT_FAULT_FLOW);
try {
- InvocationResponse pi = invoke(msgContext, IS_OUTBOUND, NOT_RESUMING_EXECUTION);
+ InvocationResponse pi = invoke(msgContext, NOT_RESUMING_EXECUTION);
if (pi.equals(InvocationResponse.SUSPEND)) {
log.warn(msgContext.getLogIDString() +
@@ -453,7 +460,7 @@
msgContext.setExecutionChain((ArrayList) msgContext.getConfigurationContext()
.getAxisConfiguration().getOutFaultFlowPhases().clone());
msgContext.setFLOW(MessageContext.OUT_FAULT_FLOW);
- InvocationResponse pi = invoke(msgContext, IS_OUTBOUND, NOT_RESUMING_EXECUTION);
+ InvocationResponse pi = invoke(msgContext, NOT_RESUMING_EXECUTION);
if (pi.equals(InvocationResponse.CONTINUE)) {
// Actually send the SOAP Fault
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/ListenerManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/ListenerManager.java?view=diff&rev=547926&r1=547925&r2=547926
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/ListenerManager.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/ListenerManager.java Sat Jun 16 07:21:09 2007
@@ -40,6 +40,10 @@
private static final Log log = LogFactory.getLog(ListenerManager.class);
public static ConfigurationContext defaultConfigurationContext;
+ public static ListenerManager getDefaultListenerManager() {
+ if (defaultConfigurationContext == null) return null;
+ return defaultConfigurationContext.getListenerManager();
+ }
private ConfigurationContext configctx;
private HashMap startedTransports = new HashMap();
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?view=diff&rev=547926&r1=547925&r2=547926
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java Sat Jun 16 07:21:09 2007
@@ -231,8 +231,21 @@
return InvocationResponse.CONTINUE;
}
+ /**
+ * Send a message (which must be a response) via the OutputStream sitting in the
+ * MessageContext TRANSPORT_OUT property. Since this class is used for both requests and
+ * responses, we split the logic - this method always gets called when we're
+ * writing to the HTTP response stream, and sendUsingCommons() is used for requests.
+ *
+ * @param msgContext the active MessageContext
+ * @param format output formatter for our message
+ * @throws AxisFault if a general problem arises
+ * @throws XMLStreamException if there's a problem writing
+ */
private void sendUsingOutputStream(MessageContext msgContext,
OMOutputFormat format) throws AxisFault, XMLStreamException {
+
+
OutputStream out = (OutputStream) msgContext
.getProperty(MessageContext.TRANSPORT_OUT);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java?view=diff&rev=547926&r1=547925&r2=547926
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java Sat Jun 16 07:21:09 2007
@@ -287,7 +287,6 @@
isTwoChannel = operationContext.getProperty(Constants.DIFFERENT_EPR);
}
-
if ((contextWritten != null) && Constants.VALUE_TRUE.equals(contextWritten)) {
if ((isTwoChannel != null) && Constants.VALUE_TRUE.equals(isTwoChannel)) {
response.setStatus(HttpStatus.SC_ACCEPTED);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpService.java?view=diff&rev=547926&r1=547925&r2=547926
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpService.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpService.java Sat Jun 16 07:21:09 2007
@@ -117,16 +117,15 @@
MessageContext msgContext = configurationContext.createMessageContext();
msgContext.setIncomingTransportName(Constants.TRANSPORT_HTTP);
- if (conn instanceof HttpInetConnection) {
- HttpInetConnection inetconn = (HttpInetConnection) conn;
+ if (conn != null) {
msgContext.setProperty(MessageContext.REMOTE_ADDR,
- inetconn.getRemoteAddress().getHostAddress());
+ conn.getRemoteAddress().getHostAddress());
msgContext.setProperty(MessageContext.TRANSPORT_ADDR,
- inetconn.getLocalAddress().getHostAddress());
+ conn.getLocalAddress().getHostAddress());
if (LOG.isDebugEnabled()) {
LOG.debug("Remote address of the connection : " +
- inetconn.getRemoteAddress().getHostAddress());
+ conn.getRemoteAddress().getHostAddress());
}
}
@@ -261,6 +260,7 @@
msgContext.setProperty(RequestResponseTransport.TRANSPORT_CONTROL,
new SimpleHTTPRequestResponseTransport());
+
this.worker.service(request, response, msgContext);
} catch (SocketException ex) {
// Socket is unreliable.
@@ -270,8 +270,6 @@
throw ex;
} catch (Throwable e) {
- AxisEngine engine = new AxisEngine(this.configurationContext);
-
msgContext.setProperty(MessageContext.TRANSPORT_OUT,
response.getOutputStream());
msgContext.setProperty(Constants.OUT_TRANSPORT_INFO,
@@ -297,7 +295,7 @@
response.sendError(HttpStatus.SC_INTERNAL_SERVER_ERROR, "Internal server error");
}
}
- engine.sendFault(faultContext);
+ AxisEngine.sendFault(faultContext);
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java?view=diff&rev=547926&r1=547925&r2=547926
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java Sat Jun 16 07:21:09 2007
@@ -77,6 +77,8 @@
newmsgCtx.setTransportIn(inMessageContext.getTransportIn());
newmsgCtx.setTransportOut(inMessageContext.getTransportOut());
newmsgCtx.setServerSide(inMessageContext.isServerSide());
+
+ // TODO: Should this be specifying (or defaulting to) the "response" relationshipType??
newmsgCtx.addRelatesTo(new RelatesTo(inMessageContext.getOptions().getMessageId()));
newmsgCtx.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,
@@ -102,11 +104,6 @@
newmsgCtx.setOperationContext(inMessageContext.getOperationContext());
- ServiceContext serviceContext = inMessageContext.getServiceContext();
- if (serviceContext != null) {
- newmsgCtx.setServiceContext(serviceContext);
- }
-
newmsgCtx.setProperty(MessageContext.TRANSPORT_OUT,
inMessageContext.getProperty(MessageContext.TRANSPORT_OUT));
newmsgCtx.setProperty(Constants.OUT_TRANSPORT_INFO,
@@ -253,17 +250,11 @@
// Create a basic response MessageContext with basic fields copied
MessageContext faultContext = createResponseMessageContext(processingContext);
- String contentType = (String) processingContext
- .getProperty(Constants.Configuration.CONTENT_TYPE_OF_FAULT);
- if (contentType != null) {
- faultContext.setProperty(Constants.Configuration.CONTENT_TYPE, contentType);
- }
-
// Register the fault message context
- if (processingContext.getAxisOperation() != null &&
- processingContext.getOperationContext() != null) {
- processingContext.getAxisOperation()
- .addFaultMessageContext(faultContext, processingContext.getOperationContext());
+ OperationContext operationContext = processingContext.getOperationContext();
+ if (operationContext != null) {
+ processingContext.getAxisOperation().addFaultMessageContext(faultContext,
+ operationContext);
}
faultContext.setProcessingFault(true);
@@ -271,30 +262,34 @@
// Set wsa:Action for response message
// Use specified value if available
- AxisOperation op = processingContext.getAxisOperation();
- if (op != null && op.getFaultAction() != null) {
- faultContext.setWSAAction(op.getFaultAction());
- } else { //If, for some reason there is no value set, should use a sensible action.
- faultContext.setWSAAction(Final.WSA_SOAP_FAULT_ACTION);
- }
- // override if the fault action has been set in the AxisFault
- if (e instanceof AxisFault) {
- if(((AxisFault)e).getFaultAction() != null){
- faultContext.setWSAAction(((AxisFault)e).getFaultAction());
- }
+
+ String faultAction = (e instanceof AxisFault) ? ((AxisFault)e).getFaultAction() : null;
+
+ if (faultAction == null) {
+ AxisOperation op = processingContext.getAxisOperation();
+ if (op != null && op.getFaultAction() != null) {
+ // TODO: Should the op be able to pick a fault action based on the fault?
+ faultAction = op.getFaultAction();
+ } else { //If, for some reason there is no value set, should use a sensible action.
+ faultAction = Final.WSA_SOAP_FAULT_ACTION;
+ }
}
+ faultContext.setWSAAction(faultAction);
+
// there are some information that the fault thrower wants to pass to the fault path.
// Means that the fault is a ws-addressing one hence use the ws-addressing fault action.
Object faultInfoForHeaders =
processingContext.getProperty(Constants.FAULT_INFORMATION_FOR_HEADERS);
if (faultInfoForHeaders != null) {
faultContext.setProperty(Constants.FAULT_INFORMATION_FOR_HEADERS, faultInfoForHeaders);
+
+ // Note that this overrides any action set above
faultContext.setWSAAction(Final.WSA_FAULT_ACTION);
}
- // if the exception is due to a problem in the faultTo header itself, we can not use those
- // fault informatio to send the error. Try to send using replyTo, leave it to transport
+ // if the exception is due to a problem in the faultTo header itself, we can not use that
+ // fault information to send the error. Try to send using replyTo, else leave it to transport
boolean shouldSendFaultToFaultTo =
AddressingHelper.shouldSendFaultToFaultTo(processingContext);
EndpointReference faultTo = processingContext.getFaultTo();
@@ -331,6 +326,7 @@
faultContext.setEnvelope(envelope);
//get the SOAP headers, user is trying to send in the fault
+ // TODO: Rationalize this mechanism a bit - maybe headers should live in the fault?
List soapHeadersList =
(List) processingContext.getProperty(SOAPConstants.HEADER_LOCAL_NAME);
if (soapHeadersList != null) {
@@ -341,6 +337,7 @@
}
}
+ // TODO: Transport-specific stuff in here? Why? Is there a better way?
// now add HTTP Headers
faultContext.setProperty(HTTPConstants.HTTP_HEADERS,
processingContext.getProperty(HTTPConstants.HTTP_HEADERS));
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java?view=diff&rev=547926&r1=547925&r2=547926
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java Sat Jun 16 07:21:09 2007
@@ -244,14 +244,16 @@
}
/**
- * To get the name of the module , where archive name is combination of module name + its version
- * The format of the module version will be like follow
- * moduleName-00.0000 as an exmple addressing-01.0001.aar
+ * Get the name of the module , where archive name is combination of module name + its version
+ * The format of the name is as follows:
+ * moduleName-00.0000
+ * Example: "addressing-01.0001.mar" would return "addressing"
+ * @param moduleName the name of the module archive
+ * @return the module name parsed out of the file name
*/
-
public static String getModuleName(String moduleName) {
- char version_seperator = '-';
- int version_index = moduleName.lastIndexOf(version_seperator);
+ char delimiter = '-';
+ int version_index = moduleName.lastIndexOf(delimiter);
if (version_index > 0) {
return moduleName.substring(0, version_index);
} else {
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org