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/04/23 23:37:38 UTC

cvs commit: ws-axis/java/src/org/apache/axis/attachments DimeBodyPart.java

dims        2005/04/23 14:37:38

  Modified:    java/src/org/apache/axis/attachments DimeBodyPart.java
  Log:
  Fix for AXIS-1906 - CLONE -dime attachment content is empty if datahandler's source is not FileDataSource
  Fix for AXIS-1126 - dime attachment content is empty if datahandler's source is not FileDataSource
  
  Notes:
  - Need to use HTTP 1.1 to prevent the problem if getting the size of the stream.
  - After this fix, CommonsHTTPSender should work fine out of the box.
  - If you want to use HTTPSender, then switch on the HTTP11 chunked support using the following code:
          call.setProperty(MessageContext.HTTP_TRANSPORT_VERSION,
                  HTTPConstants.HEADER_PROTOCOL_V11);
          Hashtable httpconf = new Hashtable();
          httpconf.put(HTTPConstants.HEADER_TRANSFER_ENCODING,
                HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED);
          call.setProperty(HTTPConstants.REQUEST_HEADERS,httpconf);
  
  Revision  Changes    Path
  1.26      +6 -4      ws-axis/java/src/org/apache/axis/attachments/DimeBodyPart.java
  
  Index: DimeBodyPart.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/attachments/DimeBodyPart.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- DimeBodyPart.java	15 Mar 2005 21:42:02 -0000	1.25
  +++ DimeBodyPart.java	23 Apr 2005 21:37:38 -0000	1.26
  @@ -221,12 +221,14 @@
                       Messages.getMessage("attach.dimeMaxChunkSize0", "" + maxchunk));
           if (maxchunk > MAX_DWORD) throw new IllegalArgumentException(
                       Messages.getMessage("attach.dimeMaxChunkSize1", "" + maxchunk));
  -        if (data instanceof byte[])
  +        if (data instanceof byte[]) {
               send(os, position, (byte[]) data, maxchunk);
  -        else if (data instanceof DynamicContentDataHandler) 
  +        } else if (data instanceof DynamicContentDataHandler) {
               send(os, position, (DynamicContentDataHandler) data, maxchunk);
  -        else if (data instanceof DataHandler)
  -            send(os, position, (DataHandler) data, maxchunk);
  +        } else if (data instanceof DataHandler) {
  +            DynamicContentDataHandler dh2 = new DynamicContentDataHandler(((DataHandler)data).getDataSource());
  +            send(os, position, dh2, maxchunk);
  +        }
       }
   
       /**