axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Veithen <andreas.veit...@gmail.com>
Subject Re: [axis2] How to set Content Type for SwA type attachment
Date Sun, 26 Jul 2009 20:44:33 GMT
Vadim,

By default, Axiom uses "binary" for all attachments. If you have a
requirement to send some attachments as base64, you can use
ConfigurableDataHandler. This class extends DataHandler but allows to
set the transfer encoding.

Regards,

Andreas

On Fri, Jul 24, 2009 at 17:15, Vadim
Letitchevski<vletitchevski@teledyne.com> wrote:
> Thanks a lot Andreas.
> And by the way I forgot to thank you for your help last time with addAttachment.
> I found another solution for Content Type:
>
>        MimetypesFileTypeMap map = new MimetypesFileTypeMap();
>        map.getDefaultFileTypeMap();
>        map.addMimeTypes("application/tar.gz gz");
>        map.setDefaultFileTypeMap(map);
>
> I am looking now into another problem. I would like to be in control of the Content-Transfer-Encoding.
The spec in my project is calling for either binary or base64 to be selected. How to do that
in SwA type attachment?
>
>
> Thanks
> Vadim.
> (310)765-3812
>
> -----Original Message-----
> From: Andreas Veithen [mailto:andreas.veithen@gmail.com]
> Sent: Friday, July 24, 2009 12:13 AM
> To: axis-user@ws.apache.org
> Subject: Re: [axis2] How to set Content Type for SwA type attachment
>
> Vadim,
>
> The content type of the attachment is determined by a call to DataSource#getContentType().
The problem is that FileDataSource doesn't allow you to set the content type explicitly, but
uses some filetype mapping mechanism. There is an alternative implementation called "CachedFileDataSource"
in Axiom that allows you to set the content type yourself.
>
> Regards,
>
> Andreas
>
> On Thu, Jul 23, 2009 at 23:08, Vadim
> Letitchevski<vletitchevski@teledyne.com> wrote:
>> I have used "Sample client which sends a message with SwA type attachments"
>> code snippet to adjust my Stab generated from WSDL.
>> Particularly these strings:
>>
>>         FileDataSource fileDataSource = new
>> FileDataSource("Name.tar.gz");
>>         DataHandler dataHandler = new DataHandler(fileDataSource);
>>         _messageContext.addAttachment(myclass.getPartData().getHref(),
>> dataHandler);
>> There are some things I wish were a bit more manageable.
>> Can anyone tell me how to set the attachment Content Type. When I
>> attach file "Name.tar.gz" the automatic selection sets it to
>> "application/octet-stream" where I would like to see "application/tar.gz".
>>
>>
>> Thanks
>> Vadim.
>> (310)765-3812
>>
>>
>

Mime
View raw message