Author: sagara
Date: Sun May 15 10:46:20 2011
New Revision: 1103312
URL: http://svn.apache.org/viewvc?rev=1103312&view=rev
Log:
Temperately revert changes from Heshan for 1.6.0 release.
Modified:
axis/axis2/java/core/branches/1_6/modules/transport/local/src/org/apache/axis2/transport/local/LocalResponder.java
axis/axis2/java/core/branches/1_6/modules/transport/local/src/org/apache/axis2/transport/local/LocalTransportReceiver.java
axis/axis2/java/core/branches/1_6/modules/transport/local/src/org/apache/axis2/transport/local/LocalTransportSender.java
Modified:
axis/axis2/java/core/branches/1_6/modules/transport/local/src/org/apache/axis2/transport/local/LocalResponder.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/transport/local/src/org/apache/axis2/transport/local/LocalResponder.java?rev=1103312&r1=1103311&r2=1103312&view=diff
==============================================================================
---
axis/axis2/java/core/branches/1_6/modules/transport/local/src/org/apache/axis2/transport/local/LocalResponder.java
(original)
+++
axis/axis2/java/core/branches/1_6/modules/transport/local/src/org/apache/axis2/transport/local/LocalResponder.java
Sun May 15 10:46:20 2011
@@ -20,40 +20,32 @@
package org.apache.axis2.transport.local;
-import org.apache.axiom.om.OMXMLParserWrapper;
-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.builder.BuilderUtil;
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 javax.xml.stream.XMLStreamException;
-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)
@@ -95,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) {
@@ -136,95 +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);
- OMXMLParserWrapper builder;
-
- try {
- builder = BuilderUtil.getBuilder(streamReader);
- } catch (XMLStreamException e) {
- throw AxisFault.makeFault(e);
- }
-
- return (SOAPEnvelope) builder.getDocumentElement();
- }
}
Modified:
axis/axis2/java/core/branches/1_6/modules/transport/local/src/org/apache/axis2/transport/local/LocalTransportReceiver.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/transport/local/src/org/apache/axis2/transport/local/LocalTransportReceiver.java?rev=1103312&r1=1103311&r2=1103312&view=diff
==============================================================================
---
axis/axis2/java/core/branches/1_6/modules/transport/local/src/org/apache/axis2/transport/local/LocalTransportReceiver.java
(original)
+++
axis/axis2/java/core/branches/1_6/modules/transport/local/src/org/apache/axis2/transport/local/LocalTransportReceiver.java
Sun May 15 10:46:20 2011
@@ -35,8 +35,6 @@ 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 javax.xml.stream.XMLStreamException;
import java.io.InputStream;
@@ -44,14 +42,9 @@ import java.io.InputStreamReader;
import java.io.OutputStream;
public class LocalTransportReceiver {
- 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;
@@ -61,11 +54,6 @@ public class LocalTransportReceiver {
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 {
@@ -93,27 +81,12 @@ public class LocalTransportReceiver {
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(
@@ -153,15 +126,6 @@ public class LocalTransportReceiver {
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.
@@ -171,10 +135,6 @@ public class LocalTransportReceiver {
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/branches/1_6/modules/transport/local/src/org/apache/axis2/transport/local/LocalTransportSender.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/transport/local/src/org/apache/axis2/transport/local/LocalTransportSender.java?rev=1103312&r1=1103311&r2=1103312&view=diff
==============================================================================
---
axis/axis2/java/core/branches/1_6/modules/transport/local/src/org/apache/axis2/transport/local/LocalTransportSender.java
(original)
+++
axis/axis2/java/core/branches/1_6/modules/transport/local/src/org/apache/axis2/transport/local/LocalTransportSender.java
Sun May 15 10:46:20 2011
@@ -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;
- }
}