1 18 package org.apache.axis2.transport.local; 19 20 import org.apache.axis2.addressing.EndpointReference; 21 import org.apache.axis2.context.MessageContext; 22 import org.apache.axis2.engine.AxisFault; 23 import org.apache.axis2.transport.AbstractTransportSender; 24 25 import java.io.*; 26 27 28 public class LocalTransportSender extends AbstractTransportSender { 29 private ByteArrayOutputStream out; 30 public LocalTransportSender() { 31 32 } 33 34 public OutputStream startSendWithToAddress(MessageContext msgContext, OutputStream out) throws AxisFault { 35 return out; 36 } 37 38 public void finalizeSendWithToAddress(MessageContext msgContext,OutputStream out) 39 throws AxisFault { 40 try { 41 InputStream in = new ByteArrayInputStream(this.out.toByteArray()); 42 LocalTransportReceiver localTransportReceiver = new LocalTransportReceiver(); 43 localTransportReceiver.processMessage(in, msgContext.getTo()); 44 in.close(); 45 out.close(); 46 } catch (IOException e) { 47 throw new AxisFault(e); 48 } 49 } 50 51 54 protected OutputStream openTheConnection(EndpointReference epr,MessageContext msgContext) throws AxisFault { 55 out = new ByteArrayOutputStream(); 57 return out; 58 } 59 60 63 public OutputStream startSendWithOutputStreamFromIncomingConnection( 64 MessageContext msgContext, 65 OutputStream out) 66 throws AxisFault { 67 throw new UnsupportedOperationException (); 68 69 } 70 71 public void finalizeSendWithOutputStreamFromIncomingConnection( 72 MessageContext msgContext,OutputStream out) 73 throws AxisFault { 74 throw new UnsupportedOperationException (); 75 76 } 77 78 public void cleanUp(MessageContext msgContext) throws AxisFault { 79 } 80 81 } 82 | Popular Tags |