Hi Bojan,

you can use JavaMail for that. Below is a code snippet that extracts all the
parts of the form data (probably could need some cleanup though). I don't
know if this solution works under all circumstances, but we're using it
regularly with no problems so far.

Best regards

  Andreas Junghans


Properties props = System.getProperties();
javax.mail.Session session = javax.mail.Session.getDefaultInstance(props,
null);
String headers = "Content-Type: " + request.getContentType() + "\r\n\r\n";
InputStream messageIS = null;
MimeMessage message = null;
messageIS = new SequenceInputStream(new
ByteArrayInputStream(headers.getBytes()), request.getInputStream());
message = new MimeMessage(session, messageIS);

MimeMultipart multi = (MimeMultipart) message.getContent();
int count = multi.getCount();
int i;
MimeBodyPart part = null;
String name;
String content;
for (i = 0; i < count; ++i) {
    part = (MimeBodyPart) multi.getBodyPart(i);
    disp = part.getHeader("Content-Disposition")[0];
    name = disp.substring(disp.indexOf("name=\"") + 6);
    name = name.substring(0, name.indexOf('"'));
    ...
    content = (String)part.getContent();
    ...
}



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to