Hello
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
wrong...
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("writeTo:");
System.out.println("obj: " + obj);
System.out.println("obj.getClass(): " +
obj.getClass());
System.out.println("mimeType: " + mimeType);
System.out.println("OutputStream.getClass: " +
os.getClass());
try {
InputStream is = (InputStream)obj;
int c = 0;
while((c = is.read()) != -1) {
os.write(c);
}
} catch(Exception e) {
e.printStackTrace();
}
}
My SOAP-Attachment-Code looks like this:
MailcapCommandMap cm = (MailcapCommandMap)
CommandMap.getDefaultCommandMap();
cm.addMailcap("application/octet-stream;;
x-java-content-handler=com.ascom.srv.file.OctetStreamDataContentHandler");
MessageContext mc =
servletEndpointContext.getMessageContext();
AttachmentPart att =
MessageFactory.newInstance().createMessage()
.createAttachmentPart();
att.setMimeHeader("Content-Type",
"application/octet-stream");
att.setMimeHeader("Content-Transfer-Encoding",
"base64");
att.setContentId("distributedFile");
FileInputStream fis = new
FileInputStream("/tmp/bla.tar");
att.setContent(fis,
"application/octet-stream");
I hope someone can help... thanks a lot
Regards
Oliver Jaun
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net