You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/12/16 18:18:08 UTC
svn commit: r357187 [13/25] - in
/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2: ./
addressing/ client/ client/async/ context/ deployment/ deployment/listener/
deployment/repository/util/ deployment/scheduler/ deployment/util/
descript...
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseResolver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseResolver.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseResolver.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseResolver.java Fri Dec 16 09:13:57 2005
@@ -1,22 +1,28 @@
/*
- * 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.
- */
+* 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.phaseresolver;
-import org.apache.axis2.description.*;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.Flow;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.description.ModuleDescription;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.description.TransportOutDescription;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.engine.Phase;
@@ -29,16 +35,18 @@
* Class PhaseResolver
*/
public class PhaseResolver {
+ private static final int IN_FLOW = 1;
+ private static final int OUT_FAULT_FLOW = 5;
+
/**
* Field axisConfig
*/
private AxisConfiguration axisConfig;
+
/**
* Field phaseHolder
*/
private PhaseHolder phaseHolder;
- private static final int IN_FLOW = 1;
- private static final int OUT_FAULT_FLOW = 5;
/**
* default constructor , to obuild chains for GlobalDescription
@@ -49,196 +57,242 @@
this.axisConfig = engineConfig;
}
- /**
- * Method buildTranspotsChains
- *
- * @throws PhaseException
- */
- public void buildTranspotsChains() throws PhaseException {
- HashMap axisTransportIn = axisConfig.getTransportsIn();
- HashMap axisTransportOut = axisConfig.getTransportsOut();
-
- Collection colintrnsport = axisTransportIn.values();
- for (Iterator iterator = colintrnsport.iterator();
- iterator.hasNext();) {
- TransportInDescription transport = (TransportInDescription) iterator.next();
- buildINTransportChains(transport);
- }
-
- Collection colouttrnsport = axisTransportOut.values();
- for (Iterator iterator = colouttrnsport.iterator();
- iterator.hasNext();) {
- TransportOutDescription transport = (TransportOutDescription) iterator.next();
- buildOutTransportChains(transport);
- }
- }
-
-
- private void buildINTransportChains(TransportInDescription transport)
- throws PhaseException {
+ private void buildINTransportChains(TransportInDescription transport) throws PhaseException {
Flow flow = null;
Phase phase = null;
+
for (int type = IN_FLOW; type < OUT_FAULT_FLOW; type++) {
switch (type) {
- case PhaseMetadata.IN_FLOW: {
+ case PhaseMetadata.IN_FLOW : {
flow = transport.getInFlow();
phase = transport.getInPhase();
+
break;
}
- case PhaseMetadata.FAULT_IN_FLOW: {
+
+ case PhaseMetadata.FAULT_IN_FLOW : {
flow = transport.getFaultFlow();
phase = transport.getFaultPhase();
+
break;
}
}
+
if (flow != null) {
ArrayList handlers = new ArrayList();
+
for (int j = 0; j < flow.getHandlerCount(); j++) {
HandlerDescription metadata = flow.getHandler(j);
+
metadata.getRules().setPhaseName(PhaseMetadata.TRANSPORT_PHASE);
handlers.add(metadata);
}
+
new PhaseHolder().buildTransportHandlerChain(phase, handlers);
} else {
}
}
}
-
/**
* Method buildTransportChains
*
* @param transport
* @throws PhaseException
*/
- private void buildOutTransportChains(TransportOutDescription transport)
- throws PhaseException {
+ private void buildOutTransportChains(TransportOutDescription transport) throws PhaseException {
Flow flow = null;
Phase phase = null;
+
for (int type = IN_FLOW; type < OUT_FAULT_FLOW; type++) {
switch (type) {
- case PhaseMetadata.OUT_FLOW: {
+ case PhaseMetadata.OUT_FLOW : {
flow = transport.getOutFlow();
phase = transport.getOutPhase();
+
break;
}
- case PhaseMetadata.FAULT_OUT_FLOW: {
+
+ case PhaseMetadata.FAULT_OUT_FLOW : {
flow = transport.getFaultFlow();
phase = transport.getFaultPhase();
+
break;
}
}
+
if (flow != null) {
ArrayList handlers = new ArrayList();
+
for (int j = 0; j < flow.getHandlerCount(); j++) {
HandlerDescription metadata = flow.getHandler(j);
+
metadata.getRules().setPhaseName(PhaseMetadata.TRANSPORT_PHASE);
handlers.add(metadata);
}
+
new PhaseHolder().buildTransportHandlerChain(phase, handlers);
} else {
}
}
}
- public void engageModuleToOperation(AxisOperation axisOperation,
- ModuleDescription module) throws PhaseException {
+ /**
+ * Method buildTranspotsChains
+ *
+ * @throws PhaseException
+ */
+ public void buildTranspotsChains() throws PhaseException {
+ HashMap axisTransportIn = axisConfig.getTransportsIn();
+ HashMap axisTransportOut = axisConfig.getTransportsOut();
+ Collection colintrnsport = axisTransportIn.values();
+
+ for (Iterator iterator = colintrnsport.iterator(); iterator.hasNext();) {
+ TransportInDescription transport = (TransportInDescription) iterator.next();
+
+ buildINTransportChains(transport);
+ }
+
+ Collection colouttrnsport = axisTransportOut.values();
+
+ for (Iterator iterator = colouttrnsport.iterator(); iterator.hasNext();) {
+ TransportOutDescription transport = (TransportOutDescription) iterator.next();
+
+ buildOutTransportChains(transport);
+ }
+ }
+
+ public void engageModuleToOperation(AxisOperation axisOperation, ModuleDescription module)
+ throws PhaseException {
Flow flow = null;
+
for (int type = IN_FLOW; type < OUT_FAULT_FLOW; type++) {
switch (type) {
- case PhaseMetadata.IN_FLOW: {
+ case PhaseMetadata.IN_FLOW : {
ArrayList phases = new ArrayList();
+
if (axisConfig != null) {
Iterator itr_axis_config =
axisConfig.getInPhasesUptoAndIncludingPostDispatch().iterator();
+
while (itr_axis_config.hasNext()) {
Object o = itr_axis_config.next();
+
phases.add(o);
}
}
+
Iterator itr_ops = axisOperation.getRemainingPhasesInFlow().iterator();
+
while (itr_ops.hasNext()) {
Object o = itr_ops.next();
+
phases.add(o);
}
- phaseHolder =
- new PhaseHolder(phases);
+
+ phaseHolder = new PhaseHolder(phases);
+
break;
}
- case PhaseMetadata.OUT_FLOW: {
+
+ case PhaseMetadata.OUT_FLOW : {
ArrayList phases = new ArrayList();
Iterator itr_ops = axisOperation.getPhasesOutFlow().iterator();
+
while (itr_ops.hasNext()) {
Object o = itr_ops.next();
+
phases.add(o);
}
+
if (axisConfig != null) {
- Iterator itr_axis_config =
- axisConfig.getGlobalOutPhases().iterator();
+ Iterator itr_axis_config = axisConfig.getGlobalOutPhases().iterator();
+
while (itr_axis_config.hasNext()) {
Object o = itr_axis_config.next();
+
phases.add(o);
}
}
- phaseHolder =
- new PhaseHolder(phases);
+
+ phaseHolder = new PhaseHolder(phases);
+
break;
}
- case PhaseMetadata.FAULT_IN_FLOW: {
+
+ case PhaseMetadata.FAULT_IN_FLOW : {
ArrayList phases = new ArrayList();
+
if (axisConfig != null) {
Iterator itr_axis_config = axisConfig.getInFaultFlow().iterator();
+
while (itr_axis_config.hasNext()) {
Object o = itr_axis_config.next();
+
phases.add(o);
}
}
+
Iterator itr_ops = axisOperation.getPhasesInFaultFlow().iterator();
+
while (itr_ops.hasNext()) {
Object o = itr_ops.next();
+
phases.add(o);
}
- phaseHolder =
- new PhaseHolder(phases);
+
+ phaseHolder = new PhaseHolder(phases);
+
break;
}
- case PhaseMetadata.FAULT_OUT_FLOW: {
- phaseHolder =
- new PhaseHolder(axisOperation.getPhasesOutFaultFlow());
+
+ case PhaseMetadata.FAULT_OUT_FLOW : {
+ phaseHolder = new PhaseHolder(axisOperation.getPhasesOutFaultFlow());
+
break;
}
}
switch (type) {
- case PhaseMetadata.IN_FLOW: {
+ case PhaseMetadata.IN_FLOW : {
flow = module.getInFlow();
+
break;
}
- case PhaseMetadata.OUT_FLOW: {
+
+ case PhaseMetadata.OUT_FLOW : {
flow = module.getOutFlow();
+
break;
}
- case PhaseMetadata.FAULT_IN_FLOW: {
+
+ case PhaseMetadata.FAULT_IN_FLOW : {
flow = module.getFaultInFlow();
+
break;
}
- case PhaseMetadata.FAULT_OUT_FLOW: {
+
+ case PhaseMetadata.FAULT_OUT_FLOW : {
flow = module.getFaultOutFlow();
+
break;
}
}
+
if (flow != null) {
for (int j = 0; j < flow.getHandlerCount(); j++) {
HandlerDescription metadata = flow.getHandler(j);
+
phaseHolder.addHandler(metadata);
- //commented the following code to provide ability to add service module to global
- //chain
-// if (!PhaseValidator.isSystemPhases(metadata.getRules().getPhaseName())) {
-// phaseHolder.addHandler(metadata);
-// } else {
-// throw new PhaseException(Messages.getMessage(DeploymentErrorMsgs.SERVICE_MODULE_CAN_NOT_REFER_GLOBAL_PHASE,
-// metadata.getRules().getPhaseName()));
-// }
+
+ // commented the following code to provide ability to add service module to global
+ // chain
+ // if (!PhaseValidator.isSystemPhases(metadata.getRules().getPhaseName())) {
+ // phaseHolder.addHandler(metadata);
+ // } else {
+ // throw new PhaseException(Messages.getMessage(DeploymentErrorMsgs.SERVICE_MODULE_CAN_NOT_REFER_GLOBAL_PHASE,
+ // metadata.getRules().getPhaseName()));
+ // }
}
}
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/util/PhaseValidator.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/util/PhaseValidator.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/util/PhaseValidator.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/util/PhaseValidator.java Fri Dec 16 09:13:57 2005
@@ -1,32 +1,32 @@
/*
- * 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.
- */
+* 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.phaseresolver.util;
import org.apache.axis2.phaseresolver.PhaseMetadata;
public class PhaseValidator {
-
public static int SYSTEM_MODULE = 0;
public static int SERVICE_MODULE = 1;
public static boolean isSystemPhases(String phaseName) {
- return ((PhaseMetadata.PHASE_TRANSPORTIN.equals(phaseName)) ||
- (PhaseMetadata.PHASE_DISPATCH.equals(phaseName)) ||
- (PhaseMetadata.PHASE_POST_DISPATCH.equals(phaseName)) ||
- (PhaseMetadata.PHASE_PRE_DISPATCH.equals(phaseName)));
+ return ((PhaseMetadata.PHASE_TRANSPORTIN.equals(phaseName))
+ || (PhaseMetadata.PHASE_DISPATCH.equals(phaseName))
+ || (PhaseMetadata.PHASE_POST_DISPATCH.equals(phaseName))
+ || (PhaseMetadata.PHASE_PRE_DISPATCH.equals(phaseName)));
}
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInMessageReceiver.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInMessageReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInMessageReceiver.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * 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.
- */
+* 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.receivers;
@@ -24,8 +25,7 @@
/**
* This is takes care of the IN-OUT sync MEP in the server side
*/
-public abstract class AbstractInMessageReceiver
- extends AbstractMessageReceiver {
+public abstract class AbstractInMessageReceiver extends AbstractMessageReceiver {
protected Log log = LogFactory.getLog(getClass());
public abstract void invokeBusinessLogic(MessageContext inMessage) throws AxisFault;
@@ -33,5 +33,4 @@
public final void receive(final MessageContext messgeCtx) throws AxisFault {
invokeBusinessLogic(messgeCtx);
}
-
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutAsyncMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutAsyncMessageReceiver.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutAsyncMessageReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutAsyncMessageReceiver.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * 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.
- */
+* 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.receivers;
@@ -29,23 +30,26 @@
public abstract class AbstractInOutAsyncMessageReceiver extends AbstractMessageReceiver {
protected Log log = LogFactory.getLog(getClass());
- public abstract void invokeBusinessLogic(MessageContext inMessage, MessageContext outMessage, ServerCallback callback)
- throws AxisFault;
+ public abstract void invokeBusinessLogic(MessageContext inMessage, MessageContext outMessage,
+ ServerCallback callback)
+ throws AxisFault;
public final void receive(final MessageContext messageCtx) throws AxisFault {
-
final ServerCallback callback = new ServerCallback() {
public void handleResult(MessageContext result) throws AxisFault {
AxisEngine engine =
- new AxisEngine(
- messageCtx.getOperationContext().getServiceContext().getConfigurationContext());
+ new AxisEngine(messageCtx.getOperationContext().getServiceContext()
+ .getConfigurationContext());
+
engine.send(messageCtx);
}
+
public void handleFault(AxisFault fault) throws AxisFault {
AxisEngine engine =
- new AxisEngine(
- messageCtx.getOperationContext().getServiceContext().getConfigurationContext());
+ new AxisEngine(messageCtx.getOperationContext().getServiceContext()
+ .getConfigurationContext());
MessageContext faultContext = engine.createFaultMessageContext(messageCtx, fault);
+
engine.sendFault(faultContext);
}
};
@@ -53,15 +57,14 @@
public void run() {
try {
MessageContext newmsgCtx = Utils.createOutMessageContext(messageCtx);
+
invokeBusinessLogic(messageCtx, newmsgCtx, callback);
} catch (AxisFault e) {
log.error(e);
}
}
};
+
messageCtx.getConfigurationContext().getThreadPool().execute(theadedTask);
}
-
-
-
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * 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.
- */
+* 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.receivers;
@@ -26,8 +27,7 @@
* protected abstract methods are only for the sake of breaking down the logic
*/
public abstract class AbstractInOutSyncMessageReceiver extends AbstractMessageReceiver {
- public abstract void invokeBusinessLogic(MessageContext inMessage,
- MessageContext outMessage)
+ public abstract void invokeBusinessLogic(MessageContext inMessage, MessageContext outMessage)
throws AxisFault;
public final void receive(MessageContext msgContext) throws AxisFault {
@@ -37,8 +37,8 @@
AxisEngine engine =
new AxisEngine(
- msgContext.getOperationContext().getServiceContext()
- .getConfigurationContext());
+ msgContext.getOperationContext().getServiceContext().getConfigurationContext());
+
engine.send(outMsgContext);
}
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractMessageReceiver.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractMessageReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractMessageReceiver.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * 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.
- */
+* 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.receivers;
@@ -30,11 +31,9 @@
import org.apache.axis2.soap.SOAP12Constants;
import org.apache.axis2.soap.SOAPFactory;
-
public abstract class AbstractMessageReceiver implements MessageReceiver {
public static final String SERVICE_CLASS = "ServiceClass";
public static final String SCOPE = "scope";
-
protected SOAPFactory fac;
/**
@@ -44,46 +43,40 @@
* @return
* @throws AxisFault
*/
- protected Object makeNewServiceObject(MessageContext msgContext)
- throws AxisFault {
+ protected Object makeNewServiceObject(MessageContext msgContext) throws AxisFault {
try {
-
String nsURI = msgContext.getEnvelope().getNamespace().getName();
+
if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
fac = OMAbstractFactory.getSOAP12Factory();
- } else if (
- SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
+ } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
fac = OMAbstractFactory.getSOAP11Factory();
} else {
throw new AxisFault(Messages.getMessage("invalidSOAPversion"));
}
AxisService service =
- msgContext
- .getOperationContext()
- .getServiceContext()
- .getAxisService();
+ msgContext.getOperationContext().getServiceContext().getAxisService();
ClassLoader classLoader = service.getClassLoader();
Parameter implInfoParam = service.getParameter(SERVICE_CLASS);
+
if (implInfoParam != null) {
- Class implClass =
- Class.forName(
- ((String) implInfoParam.getValue()).trim(),
- true,
- classLoader);
+ Class implClass = Class.forName(((String) implInfoParam.getValue()).trim(), true,
+ classLoader);
+
return implClass.newInstance();
} else {
- throw new AxisFault(
- Messages.getMessage(
- "paramIsNotSpecified",
- "SERVICE_CLASS"));
+ throw new AxisFault(Messages.getMessage("paramIsNotSpecified", "SERVICE_CLASS"));
}
-
} catch (Exception e) {
throw AxisFault.makeFault(e);
}
}
+ public SOAPFactory getSOAPFactory() {
+ return fac;
+ }
+
/**
* Method getTheImplementationObject
*
@@ -91,49 +84,41 @@
* @return
* @throws AxisFault
*/
- protected Object getTheImplementationObject(MessageContext msgContext)
- throws AxisFault {
+ protected Object getTheImplementationObject(MessageContext msgContext) throws AxisFault {
AxisService service =
- msgContext
- .getOperationContext()
- .getServiceContext()
- .getAxisService();
-
+ msgContext.getOperationContext().getServiceContext().getAxisService();
Parameter scopeParam = service.getParameter(SCOPE);
String serviceName = service.getName();
- if (scopeParam != null
- && Constants.SESSION_SCOPE.equals(scopeParam.getValue())) {
+
+ if ((scopeParam != null) && Constants.SESSION_SCOPE.equals(scopeParam.getValue())) {
SessionContext sessionContext = msgContext.getSessionContext();
+
synchronized (sessionContext) {
- Object obj =
- sessionContext.getProperty(serviceName);
+ Object obj = sessionContext.getProperty(serviceName);
+
if (obj == null) {
obj = makeNewServiceObject(msgContext);
sessionContext.setProperty(serviceName, obj);
}
+
return obj;
}
- } else if (
- scopeParam != null
- && Constants.APPLICATION_SCOPE.equals(scopeParam.getValue())) {
+ } else if ((scopeParam != null)
+ && Constants.APPLICATION_SCOPE.equals(scopeParam.getValue())) {
ConfigurationContext globalContext = msgContext.getConfigurationContext();
+
synchronized (globalContext) {
- Object obj =
- globalContext.getProperty(serviceName);
+ Object obj = globalContext.getProperty(serviceName);
+
if (obj == null) {
obj = makeNewServiceObject(msgContext);
globalContext.setProperty(serviceName, obj);
}
+
return obj;
}
} else {
return makeNewServiceObject(msgContext);
}
}
-
- public SOAPFactory getSOAPFactory() {
- return fac;
- }
-
-
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java Fri Dec 16 09:13:57 2005
@@ -1,24 +1,24 @@
/*
- * 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.
- */
+* 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.receivers;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.engine.AxisEngine;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/RawXMLINOnlyMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/RawXMLINOnlyMessageReceiver.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/RawXMLINOnlyMessageReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/RawXMLINOnlyMessageReceiver.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * 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.
- */
+* 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.receivers;
@@ -32,9 +33,9 @@
/**
* This is a Simple java Provider.
*/
-public class RawXMLINOnlyMessageReceiver
- extends AbstractInMessageReceiver
+public class RawXMLINOnlyMessageReceiver extends AbstractInMessageReceiver
implements MessageReceiver {
+
/**
* Field log
*/
@@ -59,8 +60,7 @@
public RawXMLINOnlyMessageReceiver() {
}
- public void invokeBusinessLogic(MessageContext msgContext)
- throws AxisFault {
+ public void invokeBusinessLogic(MessageContext msgContext) throws AxisFault {
try {
// get the implementation class for the Web Service
@@ -68,49 +68,49 @@
// find the WebService method
Class ImplClass = obj.getClass();
+
DependencyManager.configureBusinessLogicProvider(obj, msgContext, null);
- AxisOperation op = msgContext.getOperationContext()
- .getAxisOperation();
+ AxisOperation op = msgContext.getOperationContext().getAxisOperation();
+
if (op == null) {
throw new AxisFault(
"Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider");
}
+
String methodName = op.getName().getLocalPart();
Method[] methods = ImplClass.getMethods();
+
for (int i = 0; i < methods.length; i++) {
if (methods[i].getName().equals(methodName)) {
this.method = methods[i];
+
break;
}
}
+
Class[] parameters = method.getParameterTypes();
- if ((parameters != null)
- && (parameters.length == 1)
- &&
- OMElement.class.getName().equals(parameters[0].getName())) {
- OMElement methodElement = msgContext.getEnvelope().getBody()
- .getFirstElement();
+ if ((parameters != null) && (parameters.length == 1)
+ && OMElement.class.getName().equals(parameters[0].getName())) {
+ OMElement methodElement = msgContext.getEnvelope().getBody().getFirstElement();
OMElement parmeter;
-
- String style = msgContext.getOperationContext()
- .getAxisOperation()
- .getStyle();
+ String style = msgContext.getOperationContext().getAxisOperation().getStyle();
if (WSDLService.STYLE_DOC.equals(style)) {
parmeter = methodElement;
+
Object[] parms = new Object[]{parmeter};
- //Need not have a return here
- method.invoke(obj, parms);
+ // Need not have a return here
+ method.invoke(obj, parms);
} else if (WSDLService.STYLE_RPC.equals(style)) {
parmeter = methodElement.getFirstElement();
+
Object[] parms = new Object[]{parmeter};
// invoke the WebService
method.invoke(obj, parms);
-
} else {
throw new AxisFault(Messages.getMessage("unknownStyle", style));
}
@@ -120,6 +120,5 @@
} catch (Exception e) {
throw AxisFault.makeFault(e);
}
-
}
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * 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.
- */
+* 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.receivers;
@@ -35,23 +36,23 @@
/**
* This is a Simple java Provider.
*/
-public class RawXMLINOutMessageReceiver
- extends AbstractInOutSyncMessageReceiver
+public class RawXMLINOutMessageReceiver extends AbstractInOutSyncMessageReceiver
implements MessageReceiver {
+
/**
* Field log
*/
protected Log log = LogFactory.getLog(getClass());
/**
- * Field scope
+ * Field classLoader
*/
- private String scope;
+ private ClassLoader classLoader;
/**
- * Field classLoader
+ * Field scope
*/
- private ClassLoader classLoader;
+ private String scope;
/**
* Constructor RawXMLProvider
@@ -60,8 +61,23 @@
scope = Constants.APPLICATION_SCOPE;
}
- public void invokeBusinessLogic(MessageContext msgContext,
- MessageContext newmsgContext)
+ public Method findOperation(AxisOperation op, Class ImplClass) {
+ Method method = null;
+ String methodName = op.getName().getLocalPart();
+ Method[] methods = ImplClass.getMethods();
+
+ for (int i = 0; i < methods.length; i++) {
+ if (methods[i].getName().equals(methodName)) {
+ method = methods[i];
+
+ break;
+ }
+ }
+
+ return method;
+ }
+
+ public void invokeBusinessLogic(MessageContext msgContext, MessageContext newmsgContext)
throws AxisFault {
try {
@@ -71,89 +87,77 @@
// find the WebService method
Class ImplClass = obj.getClass();
- //Inject the Message Context if it is asked for
+ // Inject the Message Context if it is asked for
DependencyManager.configureBusinessLogicProvider(obj, msgContext, newmsgContext);
- AxisOperation opDesc = msgContext.getOperationContext()
- .getAxisOperation();
+ AxisOperation opDesc = msgContext.getOperationContext().getAxisOperation();
Method method = findOperation(opDesc, ImplClass);
- if (method != null) {
- String style = msgContext.getOperationContext()
- .getAxisOperation()
- .getStyle();
- Class[] parameters = method.getParameterTypes();
+ if (method != null) {
+ String style =
+ msgContext.getOperationContext().getAxisOperation().getStyle();
+ Class[] parameters = method.getParameterTypes();
Object[] args = null;
- if (parameters == null || parameters.length == 0) {
+ if ((parameters == null) || (parameters.length == 0)) {
args = new Object[0];
} else if (parameters.length == 1) {
OMElement omElement = null;
+
if (WSDLService.STYLE_DOC.equals(style)) {
- omElement =
- msgContext.getEnvelope().getBody()
- .getFirstElement();
+ omElement = msgContext.getEnvelope().getBody().getFirstElement();
} else if (WSDLService.STYLE_RPC.equals(style)) {
- OMElement operationElement = msgContext.getEnvelope()
- .getBody()
- .getFirstElement();
+ OMElement operationElement =
+ msgContext.getEnvelope().getBody().getFirstElement();
+
if (operationElement != null) {
- if (operationElement.getLocalName() != null &&
- operationElement.getLocalName().startsWith(
- method.getName())) {
+ if ((operationElement.getLocalName() != null)
+ && operationElement.getLocalName().startsWith(
+ method.getName())) {
omElement = operationElement.getFirstElement();
} else {
- throw new AxisFault(Messages.getMessage("AandBdonotmatch","Operation Name","immediate child name",operationElement.getLocalName(),method.getName()));
+ throw new AxisFault(Messages.getMessage("AandBdonotmatch",
+ "Operation Name", "immediate child name",
+ operationElement.getLocalName(), method.getName()));
}
} else {
throw new AxisFault(Messages.getMessage("rpcNeedmatchingChild"));
}
} else {
- throw new AxisFault(Messages.getMessage("unknownStyle",style));
+ throw new AxisFault(Messages.getMessage("unknownStyle", style));
}
+
args = new Object[]{omElement};
} else {
throw new AxisFault(Messages.getMessage("rawXmlProivdeIsLimited"));
}
OMElement result = (OMElement) method.invoke(obj, args);
-
OMElement bodyContent = null;
+
if (WSDLService.STYLE_RPC.equals(style)) {
- OMNamespace ns = getSOAPFactory().createOMNamespace(
- "http://soapenc/", "res");
- bodyContent =
- getSOAPFactory().createOMElement(
- method.getName() + "Response", ns);
+ OMNamespace ns = getSOAPFactory().createOMNamespace("http://soapenc/", "res");
+
+ bodyContent = getSOAPFactory().createOMElement(method.getName() + "Response",
+ ns);
bodyContent.addChild(result);
} else {
bodyContent = result;
}
SOAPEnvelope envelope = getSOAPFactory().getDefaultEnvelope();
+
if (bodyContent != null) {
envelope.getBody().addChild(bodyContent);
}
+
newmsgContext.setEnvelope(envelope);
} else {
- throw new AxisFault(Messages.getMessage("methodNotImplemented",opDesc.getName().toString()));
+ throw new AxisFault(Messages.getMessage("methodNotImplemented",
+ opDesc.getName().toString()));
}
} catch (Exception e) {
throw AxisFault.makeFault(e);
}
-
- }
-
- public Method findOperation(AxisOperation op, Class ImplClass) {
- Method method = null;
- String methodName = op.getName().getLocalPart();
- Method[] methods = ImplClass.getMethods();
- for (int i = 0; i < methods.length; i++) {
- if (methods[i].getName().equals(methodName)) {
- method = methods[i];
- break;
- }
- }
- return method;
}
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/ServerCallback.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/ServerCallback.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/ServerCallback.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/ServerCallback.java Fri Dec 16 09:13:57 2005
@@ -1,27 +1,27 @@
/*
- * 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.
- */
+* 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.receivers;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
-
public interface ServerCallback {
- public void handleResult(MessageContext result) throws AxisFault;
-
public void handleFault(AxisFault fault) throws AxisFault;
+
+ public void handleResult(MessageContext result) throws AxisFault;
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/AbstractTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/AbstractTransportSender.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/AbstractTransportSender.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/AbstractTransportSender.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * 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.
- */
+* 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.transport;
@@ -28,7 +29,6 @@
import org.apache.axis2.i18n.Messages;
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMOutputFormat;
-import org.apache.axis2.om.impl.OMNodeEx;
import org.apache.axis2.soap.SOAPEnvelope;
import org.apache.axis2.transport.http.HTTPTransportUtils;
import org.apache.commons.logging.Log;
@@ -43,18 +43,17 @@
* Writer. This Class would write the SOAPMessage using either of the methods in
* the order To then Writer.
*/
-public abstract class AbstractTransportSender extends AbstractHandler implements
- TransportSender {
+public abstract class AbstractTransportSender extends AbstractHandler implements TransportSender {
+
/**
- * Field log
+ * Field NAME
*/
- private Log log = LogFactory.getLog(getClass());
+ public static final QName NAME = new QName("http://axis.ws.apache.org", "TransportSender");
/**
- * Field NAME
+ * Field log
*/
- public static final QName NAME = new QName("http://axis.ws.apache.org",
- "TransportSender");
+ private Log log = LogFactory.getLog(getClass());
/**
* Constructor AbstractTransportSender
@@ -63,9 +62,15 @@
init(new HandlerDescription(NAME));
}
- public void init(ConfigurationContext confContext,
- TransportOutDescription transportOut) throws AxisFault {
+ public abstract void finalizeSendWithOutputStreamFromIncomingConnection(
+ MessageContext msgContext, OutputStream out)
+ throws AxisFault;
+
+ public abstract void finalizeSendWithToAddress(MessageContext msgContext, OutputStream out)
+ throws AxisFault;
+ public void init(ConfigurationContext confContext, TransportOutDescription transportOut)
+ throws AxisFault {
}
/**
@@ -75,70 +80,81 @@
* @throws AxisFault
*/
public void invoke(MessageContext msgContext) throws AxisFault {
- //Check for the REST behaviour, if you desire rest beahaviour
- //put a <parameter name="doREST" value="true"/> at the axis2.xml
+
+ // Check for the REST behaviour, if you desire rest beahaviour
+ // put a <parameter name="doREST" value="true"/> at the axis2.xml
msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext));
OutputStream out;
-
EndpointReference epr = null;
- if (msgContext.getTo() != null
- && !AddressingConstants.Submission.WSA_ANONYMOUS_URL
- .equals(msgContext.getTo().getAddress())
- && !AddressingConstants.Final.WSA_ANONYMOUS_URL
- .equals(msgContext.getTo().getAddress())) {
+ if ((msgContext.getTo() != null) && !AddressingConstants.Submission.WSA_ANONYMOUS_URL
+ .equals(msgContext.getTo().getAddress()) && !AddressingConstants.Final
+ .WSA_ANONYMOUS_URL.equals(msgContext.getTo().getAddress())) {
epr = msgContext.getTo();
}
if (epr != null) {
out = openTheConnection(epr, msgContext);
+
OutputStream newOut = startSendWithToAddress(msgContext, out);
+
if (newOut != null) {
out = newOut;
}
+
writeMessage(msgContext, out);
finalizeSendWithToAddress(msgContext, out);
} else {
- out = (OutputStream) msgContext
- .getProperty(MessageContext.TRANSPORT_OUT);
+ out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT);
+
if (out != null) {
- startSendWithOutputStreamFromIncomingConnection(msgContext,
- out);
+ startSendWithOutputStreamFromIncomingConnection(msgContext, out);
writeMessage(msgContext, out);
- finalizeSendWithOutputStreamFromIncomingConnection(msgContext,
- out);
+ finalizeSendWithOutputStreamFromIncomingConnection(msgContext, out);
} else {
throw new AxisFault(
"Both the TO and Property MessageContext.TRANSPORT_WRITER is Null, No where to send");
}
}
- //TODO fix this, we do not set the value if the operation context is
+
+ // TODO fix this, we do not set the value if the operation context is
// not avalible
if (msgContext.getOperationContext() != null) {
- msgContext.getOperationContext().setProperty(
- Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE);
+ msgContext.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN,
+ Constants.VALUE_TRUE);
}
}
- public void writeMessage(MessageContext msgContext, OutputStream out)
- throws AxisFault {
+ protected abstract OutputStream openTheConnection(EndpointReference epr, MessageContext msgctx)
+ throws AxisFault;
+
+ public abstract OutputStream startSendWithOutputStreamFromIncomingConnection(
+ MessageContext msgContext, OutputStream out)
+ throws AxisFault;
+
+ public abstract OutputStream startSendWithToAddress(MessageContext msgContext, OutputStream out)
+ throws AxisFault;
+
+ public void writeMessage(MessageContext msgContext, OutputStream out) throws AxisFault {
SOAPEnvelope envelope = msgContext.getEnvelope();
OMElement outputMessage = envelope;
- if (envelope != null && msgContext.isDoingREST()) {
+ if ((envelope != null) && msgContext.isDoingREST()) {
outputMessage = envelope.getBody().getFirstElement();
}
if (outputMessage != null) {
try {
OMOutputFormat format = new OMOutputFormat();
- //Pick the char set encoding from the msgContext
- String charSetEnc = (String) msgContext
- .getProperty(MessageContext.CHARACTER_SET_ENCODING);
+
+ // Pick the char set encoding from the msgContext
+ String charSetEnc =
+ (String) msgContext.getProperty(MessageContext.CHARACTER_SET_ENCODING);
+
format.setDoOptimize(msgContext.isDoingMTOM());
format.setCharSetEncoding(charSetEnc);
- outputMessage.serializeAndConsume(out, format);
+ outputMessage.serializeAndConsume(out, format);
out.flush();
} catch (Exception e) {
throw new AxisFault(e);
@@ -147,19 +163,4 @@
throw new AxisFault(Messages.getMessage("outMessageNull"));
}
}
-
- public abstract OutputStream startSendWithToAddress(
- MessageContext msgContext, OutputStream out) throws AxisFault;
-
- public abstract void finalizeSendWithToAddress(MessageContext msgContext,
- OutputStream out) throws AxisFault;
-
- public abstract OutputStream startSendWithOutputStreamFromIncomingConnection(
- MessageContext msgContext, OutputStream out) throws AxisFault;
-
- public abstract void finalizeSendWithOutputStreamFromIncomingConnection(
- MessageContext msgContext, OutputStream out) throws AxisFault;
-
- protected abstract OutputStream openTheConnection(EndpointReference epr,
- MessageContext msgctx) throws AxisFault;
-}
\ No newline at end of file
+}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/OutTransportInfo.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/OutTransportInfo.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/OutTransportInfo.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/OutTransportInfo.java Fri Dec 16 09:13:57 2005
@@ -1,21 +1,22 @@
/*
- * 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.
- */
+* 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.transport;
public interface OutTransportInfo {
public abstract void setContentType(String contentType);
-}
\ No newline at end of file
+}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/TransportListener.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/TransportListener.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/TransportListener.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/TransportListener.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * 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.
- */
+* 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.transport;
@@ -27,8 +28,7 @@
public abstract class TransportListener {
public static final String PARAM_PORT = "port";
- public abstract void init(ConfigurationContext axisConf,
- TransportInDescription transprtIn)
+ public abstract void init(ConfigurationContext axisConf, TransportInDescription transprtIn)
throws AxisFault;
public abstract void start() throws AxisFault;
@@ -36,5 +36,4 @@
public abstract void stop() throws AxisFault;
public abstract EndpointReference getReplyToEPR(String serviceName) throws AxisFault;
-
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/TransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/TransportSender.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/TransportSender.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/TransportSender.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * 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.
- */
+* 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.transport;
@@ -23,23 +24,26 @@
import org.apache.axis2.engine.Handler;
/**
- * This send the SOAP Message to other SOAP nodes and this alone write the SOAP Message to the
+ * This send the SOAP Message to other SOAP nodes and this alone write the SOAP Message to the
* wire. Out flow must be end with one of this kind.
*/
public interface TransportSender extends Handler {
- /**
- * Initialize
- * @param confContext
- * @param transportOut
- * @throws org.apache.axis2.AxisFault
- */
- public void init(ConfigurationContext confContext,
- TransportOutDescription transportOut) throws AxisFault;
+
/**
* Clean up
+ *
* @param msgContext
* @throws org.apache.axis2.AxisFault
- */
+ */
public void cleanUp(MessageContext msgContext) throws AxisFault;
+ /**
+ * Initialize
+ *
+ * @param confContext
+ * @param transportOut
+ * @throws org.apache.axis2.AxisFault
+ */
+ public void init(ConfigurationContext confContext, TransportOutDescription transportOut)
+ throws AxisFault;
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/TransportUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/TransportUtils.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/TransportUtils.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/TransportUtils.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * 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.
- */
+* 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.transport;
@@ -34,67 +35,69 @@
import java.io.InputStream;
public class TransportUtils {
- public static SOAPEnvelope createSOAPMessage(MessageContext msgContext, String soapNamespaceURI) throws AxisFault {
+ public static SOAPEnvelope createSOAPMessage(MessageContext msgContext, String soapNamespaceURI)
+ throws AxisFault {
+ InputStream inStream = (InputStream) msgContext.getProperty(MessageContext.TRANSPORT_IN);
- InputStream inStream = (InputStream) msgContext.getProperty(
- MessageContext.TRANSPORT_IN);
msgContext.setProperty(MessageContext.TRANSPORT_IN, null);
- //this inputstram is set by the TransportSender represents a two way transport or
- //by a Transport Recevier
+
+ // this inputstram is set by the TransportSender represents a two way transport or
+ // by a Transport Recevier
if (inStream == null) {
throw new AxisFault(Messages.getMessage("inputstreamNull"));
}
+
return createSOAPMessage(msgContext, inStream, soapNamespaceURI);
}
- private static SOAPEnvelope createSOAPMessage(MessageContext msgContext,
- InputStream inStream, String soapNamespaceURI)
+ private static SOAPEnvelope createSOAPMessage(MessageContext msgContext, InputStream inStream,
+ String soapNamespaceURI)
throws AxisFault {
try {
Object contentType = null;
OperationContext opContext = msgContext.getOperationContext();
+
if (opContext != null) {
- contentType =
- opContext.getProperty(
- HTTPConstants.MTOM_RECIVED_CONTENT_TYPE);
+ contentType = opContext.getProperty(HTTPConstants.MTOM_RECIVED_CONTENT_TYPE);
} else {
throw new AxisFault(Messages.getMessage("cannotBeNullOperationContext"));
}
StAXBuilder builder = null;
SOAPEnvelope envelope = null;
+ String charSetEnc =
+ (String) msgContext.getProperty(MessageContext.CHARACTER_SET_ENCODING);
- String charSetEnc = (String)msgContext.getProperty(MessageContext.CHARACTER_SET_ENCODING);
- if(charSetEnc == null) {
- charSetEnc = (String)opContext.getProperty(MessageContext.CHARACTER_SET_ENCODING);
+ if (charSetEnc == null) {
+ charSetEnc = (String) opContext.getProperty(MessageContext.CHARACTER_SET_ENCODING);
}
- if(charSetEnc == null) {
- charSetEnc = MessageContext.DEFAULT_CHAR_SET_ENCODING;
+
+ if (charSetEnc == null) {
+ charSetEnc = MessageContext.DEFAULT_CHAR_SET_ENCODING;
}
-
- if (contentType != null) {
+
+ if (contentType != null) {
msgContext.setDoingMTOM(true);
- builder =
- HTTPTransportUtils.selectBuilderForMIME(msgContext,
- inStream,
- (String) contentType);
+ builder = HTTPTransportUtils.selectBuilderForMIME(msgContext, inStream,
+ (String) contentType);
envelope = (SOAPEnvelope) builder.getDocumentElement();
} else if (msgContext.isDoingREST()) {
XMLStreamReader xmlreader =
- XMLInputFactory.newInstance().createXMLStreamReader(
- inStream,charSetEnc);
+ XMLInputFactory.newInstance().createXMLStreamReader(inStream, charSetEnc);
SOAPFactory soapFactory = new SOAP11Factory();
+
builder = new StAXOMBuilder(xmlreader);
builder.setOmbuilderFactory(soapFactory);
envelope = soapFactory.getDefaultEnvelope();
envelope.getBody().addChild(builder.getDocumentElement());
} else {
XMLStreamReader xmlreader =
- XMLInputFactory.newInstance().createXMLStreamReader(
- inStream,charSetEnc);
+ XMLInputFactory.newInstance().createXMLStreamReader(inStream, charSetEnc);
+
builder = new StAXSOAPModelBuilder(xmlreader, soapNamespaceURI);
envelope = (SOAPEnvelope) builder.getDocumentElement();
}
+
return envelope;
} catch (Exception e) {
throw new AxisFault(e);
@@ -111,24 +114,27 @@
*/
public static String getCharSetEncoding(String contentType) {
int index = contentType.indexOf(HTTPConstants.CHAR_SET_ENCODING);
- if (index == -1) { //Charset encoding not found in the contect-type header
- //Using the default UTF-8
+
+ if (index == -1) { // Charset encoding not found in the contect-type header
+
+ // Using the default UTF-8
return MessageContext.DEFAULT_CHAR_SET_ENCODING;
}
- //If there are spaces around the '=' sign
+ // If there are spaces around the '=' sign
int indexOfEq = contentType.indexOf("=", index);
- //There can be situations where "charset" is not the last parameter of the Content-Type header
+
+ // There can be situations where "charset" is not the last parameter of the Content-Type header
int indexOfSemiColon = contentType.indexOf(";", indexOfEq);
String value;
+
if (indexOfSemiColon > 0) {
value = (contentType.substring(indexOfEq + 1, indexOfSemiColon));
} else {
- value = (contentType.substring(indexOfEq + 1, contentType.length()))
- .trim();
+ value = (contentType.substring(indexOfEq + 1, contentType.length())).trim();
}
- //There might be "" around the value - if so remove them
+ // There might be "" around the value - if so remove them
value = value.replaceAll("\"", "");
if ("null".equalsIgnoreCase(value)) {
@@ -136,6 +142,5 @@
}
return value.trim();
-
}
}