You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2016/04/24 15:16:30 UTC
svn commit: r1740693 - in
/axis/axis2/java/core/trunk/modules/transport/local/src/org/apache/axis2/transport/local:
LocalResponder.java LocalTransportReceiver.java LocalTransportSender.java
NonBlockingLocalTransportSender.java
Author: veithen
Date: Sun Apr 24 13:16:30 2016
New Revision: 1740693
URL: http://svn.apache.org/viewvc?rev=1740693&view=rev
Log:
Roll back r1073331 (AXIS2-4944), r1075091 (AXIS2-4963) and r1075243 (AXIS2-4961): since Synapse will be moved to the Attic (and there is no Synapse release that uses Axis2 1.7.x), it makes no sense to keep around a transport sender (NonBlockingLocalTransportSender) that only works with Synapse, but not with Axis2.
svn merge -c -1726131 modules/transport/local/src/org/apache/axis2/transport/local/LocalResponder.java modules/transport/local/src/org/apache/axis2/transport/local/LocalResponder.java
svn merge -c -1101320 . .
svn merge -c -1075243 . .
svn merge -c -1075091 . .
svn merge -c -1073331 . .
Removed:
axis/axis2/java/core/trunk/modules/transport/local/src/org/apache/axis2/transport/local/NonBlockingLocalTransportSender.java
Modified:
axis/axis2/java/core/trunk/modules/transport/local/src/org/apache/axis2/transport/local/LocalResponder.java
axis/axis2/java/core/trunk/modules/transport/local/src/org/apache/axis2/transport/local/LocalTransportReceiver.java
axis/axis2/java/core/trunk/modules/transport/local/src/org/apache/axis2/transport/local/LocalTransportSender.java
Modified: axis/axis2/java/core/trunk/modules/transport/local/src/org/apache/axis2/transport/local/LocalResponder.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/local/src/org/apache/axis2/transport/local/LocalResponder.java?rev=1740693&r1=1740692&r2=1740693&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/transport/local/src/org/apache/axis2/transport/local/LocalResponder.java (original)
+++ axis/axis2/java/core/trunk/modules/transport/local/src/org/apache/axis2/transport/local/LocalResponder.java Sun Apr 24 13:16:30 2016
@@ -20,38 +20,32 @@
package org.apache.axis2.transport.local;
-import org.apache.axiom.om.OMXMLBuilderFactory;
-import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.addressing.RelatesTo;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.TransportOutDescription;
-import org.apache.axis2.description.WSDL2Constants;
-import org.apache.axis2.engine.AxisEngine;
import org.apache.axis2.handlers.AbstractHandler;
import org.apache.axis2.transport.TransportSender;
import org.apache.axis2.transport.TransportUtils;
-import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import java.io.*;
-import java.util.Map;
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
/**
* LocalResponder
*/
public class LocalResponder extends AbstractHandler implements TransportSender {
protected static final Log log = LogFactory.getLog(LocalResponder.class);
-
+
+
// fixed for Executing LocalTransport in MulthThread.
private OutputStream out;
public LocalResponder(OutputStream response) {
- this.out = response;
+ this.out = response;
}
public void init(ConfigurationContext confContext, TransportOutDescription transportOut)
@@ -93,38 +87,13 @@ public class LocalResponder extends Abst
TransportUtils.writeMessage(msgContext, out);
}
} else {
- if (/*(msgContext != null) &&*/ (msgContext.getOperationContext() != null) &&
- (msgContext.getOperationContext().getMessageContexts() != null)) {
- MessageContext proxyInMessageContext = msgContext.
- getOperationContext().getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN);
-
- if (proxyInMessageContext != null) {
- MessageContext initialMessageContext = (MessageContext) proxyInMessageContext.
- getProperty(LocalTransportReceiver.IN_MESSAGE_CONTEXT);
-
- if (initialMessageContext != null) {
- handleResponse(msgContext, initialMessageContext);
- } else {
- out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT);
-
- if (out != null) {
- TransportUtils.writeMessage(msgContext, out);
- } else {
- throw new AxisFault(
- "Both the TO and Property MessageContext.TRANSPORT_OUT is Null, No where to send");
- }
+ out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT);
- }
- }
+ if (out != null) {
+ TransportUtils.writeMessage(msgContext, out);
} else {
- out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT);
-
- if (out != null) {
- TransportUtils.writeMessage(msgContext, out);
- } else {
- throw new AxisFault(
- "Both the TO and Property MessageContext.TRANSPORT_OUT is Null, No where to send");
- }
+ throw new AxisFault(
+ "Both the TO and Property MessageContext.TRANSPORT_OUT is Null, No where to send");
}
}
} catch (AxisFault axisFault) {
@@ -134,87 +103,7 @@ public class LocalResponder extends Abst
}
TransportUtils.setResponseWritten(msgContext, true);
-
+
return InvocationResponse.CONTINUE;
}
-
- /**
- * Retrieves the properties from the proxyOutMessageContext and sets the values to the
- * inMessageContext.
- *
- * @param proxyOutMessageContext the active message context
- * @param initialMessageContext the initial message context, which was stored as a property
- * in the proxyOutMessageContext
- * @throws AxisFault AxisFault
- */
- private void handleResponse(MessageContext proxyOutMessageContext, MessageContext initialMessageContext) throws AxisFault {
- MessageContext inMessageContext = initialMessageContext.getOperationContext().
- getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN);
-
- // setting the properties
- Map<String, Object> initialPropertyMap = initialMessageContext.getProperties();
- initialMessageContext.setProperties(initialPropertyMap);
-
- inMessageContext.setEnvelope(getEnvelope(proxyOutMessageContext));
- inMessageContext.setAxisServiceGroup(initialMessageContext.getAxisServiceGroup());
- inMessageContext.setAxisService(initialMessageContext.getAxisService());
- inMessageContext.setAxisOperation(initialMessageContext.getAxisOperation());
- inMessageContext.setAxisMessage(initialMessageContext.getAxisOperation().getMessage(
- WSDLConstants.MESSAGE_LABEL_OUT_VALUE));
- inMessageContext.setIncomingTransportName(Constants.TRANSPORT_LOCAL);
- inMessageContext.setServiceContext(initialMessageContext.getServiceContext());
-
- // set properties on response
- inMessageContext.setServerSide(true);
- inMessageContext.setProperty(MessageContext.TRANSPORT_OUT,
- initialMessageContext.getProperty(MessageContext.TRANSPORT_OUT));
- inMessageContext.setProperty(Constants.OUT_TRANSPORT_INFO,
- initialMessageContext.getProperty(Constants.OUT_TRANSPORT_INFO));
- inMessageContext.setTransportIn(initialMessageContext.getTransportIn());
- inMessageContext.setTransportOut(initialMessageContext.getTransportOut());
-
- if (log.isDebugEnabled()) {
- log.debug("Setting AxisServiceGroup - " + initialMessageContext.getAxisServiceGroup());
- log.debug("Setting AxisService - " + initialMessageContext.getAxisService());
- log.debug("Setting AxisOperation - " + initialMessageContext.getAxisOperation());
- log.debug("Setting AxisMessage - " + initialMessageContext.getAxisOperation().
- getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE));
- log.debug("Setting Incoming Transport name - " + Constants.TRANSPORT_LOCAL);
- log.debug("Setting Service Context " + initialMessageContext.getServiceGroupContext().toString());
-
- log.debug("Setting ServerSide to true");
- log.debug("Setting " + MessageContext.TRANSPORT_OUT + " property to " +
- initialMessageContext.getProperty(MessageContext.TRANSPORT_OUT));
- log.debug("Setting " + Constants.OUT_TRANSPORT_INFO + " property to " +
- initialMessageContext.getProperty(Constants.OUT_TRANSPORT_INFO));
- log.debug("Setting TransportIn - " + initialMessageContext.getTransportIn());
- log.debug("Setting TransportOut - " + initialMessageContext.getTransportOut());
-
- log.debug("Setting ReplyTo - " + initialMessageContext.getReplyTo());
- log.debug("Setting FaultTo - " + initialMessageContext.getFaultTo());
- }
-
- // copy the message type property that is used by the out message to the response message
- inMessageContext.setProperty(Constants.Configuration.MESSAGE_TYPE,
- initialMessageContext.getProperty(Constants.Configuration.MESSAGE_TYPE));
-
- if (initialMessageContext.getMessageID() != null) {
- inMessageContext.setRelationships(
- new RelatesTo[]{new RelatesTo(initialMessageContext.getMessageID())});
- }
-
- inMessageContext.setReplyTo(initialMessageContext.getReplyTo());
- inMessageContext.setFaultTo(initialMessageContext.getFaultTo());
-
- AxisEngine.receive(inMessageContext);
- }
-
- private SOAPEnvelope getEnvelope(MessageContext messageContext) throws AxisFault {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- TransportUtils.writeMessage(messageContext, out);
-
- ByteArrayInputStream bs = new ByteArrayInputStream(out.toByteArray());
- InputStreamReader streamReader = new InputStreamReader(bs);
- return OMXMLBuilderFactory.createSOAPModelBuilder(streamReader).getSOAPEnvelope();
- }
}
Modified: axis/axis2/java/core/trunk/modules/transport/local/src/org/apache/axis2/transport/local/LocalTransportReceiver.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/local/src/org/apache/axis2/transport/local/LocalTransportReceiver.java?rev=1740693&r1=1740692&r2=1740693&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/transport/local/src/org/apache/axis2/transport/local/LocalTransportReceiver.java (original)
+++ axis/axis2/java/core/trunk/modules/transport/local/src/org/apache/axis2/transport/local/LocalTransportReceiver.java Sun Apr 24 13:16:30 2016
@@ -34,23 +34,16 @@ import org.apache.axis2.engine.AxisEngin
import org.apache.axis2.transport.TransportListener;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axis2.util.MessageContextBuilder;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
public class LocalTransportReceiver implements TransportListener {
- protected static final Log log = LogFactory.getLog(LocalTransportReceiver.class);
public static ConfigurationContext CONFIG_CONTEXT;
private ConfigurationContext confContext;
private MessageContext inMessageContext;
- /** Whether the call is blocking or non-blocking */
- private boolean nonBlocking = false;
- /** If the call is non-blocking the in message context will be stored in this property */
- public static final String IN_MESSAGE_CONTEXT = "IN_MESSAGE_CONTEXT";
public LocalTransportReceiver(ConfigurationContext configContext) {
confContext = configContext;
@@ -60,11 +53,6 @@ public class LocalTransportReceiver impl
this(CONFIG_CONTEXT);
}
- public LocalTransportReceiver(LocalTransportSender sender, boolean nonBlocking) {
- this(CONFIG_CONTEXT);
- this.nonBlocking = nonBlocking;
- }
-
public void processMessage(MessageContext inMessageContext,
InputStream in,
OutputStream response) throws AxisFault {
@@ -92,27 +80,12 @@ public class LocalTransportReceiver impl
OutputStream response)
throws AxisFault {
MessageContext msgCtx = confContext.createMessageContext();
-
- if (this.nonBlocking) {
- if (log.isDebugEnabled()) {
- log.debug("Setting the in-message context as a property(" + IN_MESSAGE_CONTEXT +
- ") to the current message context");
- }
- // Set the in-message context as a property to the current message context.
- msgCtx.setProperty(IN_MESSAGE_CONTEXT, inMessageContext);
- }
-
if (inMessageContext != null) {
- if (log.isDebugEnabled()) {
- log.debug("Setting the property " + HTTPConstants.MC_HTTP_SERVLETREQUEST + " to " +
- inMessageContext.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST));
- log.debug("Setting the property " + MessageContext.REMOTE_ADDR + " to " +
- inMessageContext.getProperty(MessageContext.REMOTE_ADDR));
- }
msgCtx.setProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST,
inMessageContext.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST));
msgCtx.setProperty(MessageContext.REMOTE_ADDR,
inMessageContext.getProperty(MessageContext.REMOTE_ADDR));
+
}
TransportInDescription tIn = confContext.getAxisConfiguration().getTransportIn(
@@ -146,15 +119,6 @@ public class LocalTransportReceiver impl
msgCtx.setEnvelope(envelope);
- if (log.isDebugEnabled()) {
- log.debug("Setting incoming Transport name - " + Constants.TRANSPORT_LOCAL);
- log.debug("Setting TransportIn - " + tIn);
- log.debug("Setting TransportOut - " + localTransportResOut);
- log.debug("Setting To address - " + to);
- log.debug("Setting WSAction - " + action);
- log.debug("Setting Envelope - " + envelope.toString());
- }
-
AxisEngine.receive(msgCtx);
} catch (AxisFault e) {
// write the fault back.
@@ -164,10 +128,6 @@ public class LocalTransportReceiver impl
faultContext.setTransportOut(localTransportResOut);
faultContext.setProperty(MessageContext.TRANSPORT_OUT, response);
- if(log.isDebugEnabled()) {
- log.debug("Setting FaultContext's TransportOut - " + localTransportResOut);
- }
-
AxisEngine.sendFault(faultContext);
} catch (AxisFault axisFault) {
// can't handle this, so just throw it
Modified: axis/axis2/java/core/trunk/modules/transport/local/src/org/apache/axis2/transport/local/LocalTransportSender.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/local/src/org/apache/axis2/transport/local/LocalTransportSender.java?rev=1740693&r1=1740692&r2=1740693&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/transport/local/src/org/apache/axis2/transport/local/LocalTransportSender.java (original)
+++ axis/axis2/java/core/trunk/modules/transport/local/src/org/apache/axis2/transport/local/LocalTransportSender.java Sun Apr 24 13:16:30 2016
@@ -98,7 +98,7 @@ public class LocalTransportSender extend
InputStream in = new ByteArrayInputStream(out.toByteArray());
ByteArrayOutputStream response = new ByteArrayOutputStream();
- LocalTransportReceiver localTransportReceiver = new LocalTransportReceiver(this, isNonBlocking());
+ LocalTransportReceiver localTransportReceiver = new LocalTransportReceiver(this);
localTransportReceiver.processMessage(msgContext, in, response);
in.close();
@@ -111,11 +111,4 @@ public class LocalTransportSender extend
throw AxisFault.makeFault(e);
}
}
-
- protected boolean isNonBlocking() {
- if (log.isDebugEnabled()) {
- log.debug("Local Transport Sender Selected");
- }
- return false;
- }
}