ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: ws-axis/java/src/org/apache/axis/transport/jms JMSSender.java SimpleJMSWorker.java
Date Tue, 23 Mar 2004 14:29:50 GMT
dims        2004/03/23 06:29:50

  Modified:    java/src/org/apache/axis/transport/jms JMSSender.java
                        SimpleJMSWorker.java
  Log:
  Fix for AXIS-1242 - Multipart messages using jms transport lack a contentType setting and
fail to parse
  
  Revision  Changes    Path
  1.8       +16 -0     ws-axis/java/src/org/apache/axis/transport/jms/JMSSender.java
  
  Index: JMSSender.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/transport/jms/JMSSender.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JMSSender.java	25 Feb 2004 14:02:46 -0000	1.7
  +++ JMSSender.java	23 Mar 2004 14:29:49 -0000	1.8
  @@ -20,6 +20,7 @@
   import org.apache.axis.Message;
   import org.apache.axis.MessageContext;
   import org.apache.axis.handlers.BasicHandler;
  +import org.apache.axis.attachments.Attachments;
   
   import javax.jms.Destination;
   import java.io.ByteArrayOutputStream;
  @@ -69,6 +70,21 @@
               msgContext.getRequestMessage().writeTo(out);
   
               HashMap props = createSendProperties(msgContext);
  +
  +            // If the request message contains attachments, set
  +            // a contentType property to go in the outgoing message header
  +            String ret = null;
  +            Message message = msgContext.getRequestMessage();
  +            Attachments mAttachments = message.getAttachmentsImpl();
  +            if (mAttachments != null && 0 != mAttachments.getAttachmentCount())

  +            {
  +                String contentType = mAttachments.getContentType();
  +                if(contentType != null && !contentType.trim().equals("")) 
  +                {
  +                    props.put("contentType", contentType);
  +                }
  +            }
  +
               boolean waitForResponse = true;
               if(msgContext.containsProperty(JMSConstants.WAIT_FOR_RESPONSE))
                   waitForResponse =
  
  
  
  1.7       +23 -1     ws-axis/java/src/org/apache/axis/transport/jms/SimpleJMSWorker.java
  
  Index: SimpleJMSWorker.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/transport/jms/SimpleJMSWorker.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SimpleJMSWorker.java	25 Feb 2004 14:02:46 -0000	1.6
  +++ SimpleJMSWorker.java	23 Mar 2004 14:29:49 -0000	1.7
  @@ -80,7 +80,29 @@
   
           // create the msg and context and invoke the server
           AxisServer server = SimpleJMSListener.getAxisServer();
  -        Message msg = new Message(in);
  +
  +        // if the incoming message has a contentType set,
  +        // pass it to my new Message
  +        String contentType = null;
  +        try 
  +        { 
  +            contentType = message.getStringProperty("contentType");
  +        } 
  +        catch(Exception e) 
  +        { 
  +            e.printStackTrace();
  +        }
  +
  +        Message msg = null;
  +        if(contentType != null && !contentType.trim().equals("")) 
  +        {
  +            msg = new Message(in, true, contentType, null);
  +        } 
  +        else 
  +        {
  +            msg = new Message(in);
  +        }
  +
           MessageContext  msgContext = new MessageContext(server);
           msgContext.setRequestMessage( msg );
           try
  
  
  

Mime
View raw message