Does AttachmentPart use DataHandler the wrong way?

From: Oliver Jaun <>
Date: Wed, 6 Oct 2004 10:45:40 -0700 (PDT)


I've sent a message a hours ago with an old subject
line...sorry. Thanks for the previous answer
(regarding setMimeHeader("Content-Type"...) but it
didn't help.

I'm trying to base64-encode a mime message myself
instead of using the built in Base64EncoderStream
(because I don't want newlines after 76 characters). I
had some problems activating my own
OctetStreamDataContentHandler but now it is invoked.
However something is strange: When I try to implement
the DataContentHandler.writeTo() methode myself it is
invoked but I get a BASE64EncoderStream output stream
to which I want to write my self-encoded data. But
this makes no sens of course because the
BASE64EncoderStream will encode it again... My
impression is that the writeTo() methode is called
with a wrong parameter by the AttachmentPart Class or
whoever calls it... maybe I get something completely

my writeTo method looks like this.

public class OctetStreamDataContentHandler implements
DataContentHandler {

    public void writeTo(Object obj, String mimeType,
OutputStream os) {

        // why is os a BASE64EncoderStream ?

        System.out.println("obj: " + obj);
        System.out.println("obj.getClass(): " +
        System.out.println("mimeType: " + mimeType);
        System.out.println("OutputStream.getClass: " +
        try {
            InputStream is = (InputStream)obj;
            int c = 0;
            while((c = != -1) {
        } catch(Exception e) {

My SOAP-Attachment-Code looks like this:

 MailcapCommandMap cm = (MailcapCommandMap)
            MessageContext mc =
            AttachmentPart att =
            FileInputStream fis = new

I hope someone can help... thanks a lot

Oliver Jaun

Do you Yahoo!?
Declare Yourself - Register online to vote today!

To unsubscribe, e-mail:
For additional commands, e-mail: