--
Christopher Hoover wrote:
>
> --
>
> [Slightly off topic ... ]
>
> Has anyone had any success using the Java Mail framework
> (javax.mail.internet) to parse multipart/form-data POST responses?
>
> All my attempts thus far have yielded a javax.mail.internet.ParseException
> when I try to create a MimeMultipart from a DataSource that reads from the
> request input stream.
It works quite well, but it is not a speed champion. I used it like this
ServletDataSource sds = new ServletDataSource(req, resp);
msg = new MimeMultipart(sds);
int parts = msg.getCount();
.....
class ServletDataSource implements DataSource
{
private String cType = "";
private OutputStream os;
private InputStream is;
private int len = -1;
ServletDataSource(HttpServletRequest in, HttpServletResponse out)
throws IOException
{
os = out.getOutputStream();
is = in.getInputStream();
len = in.getContentLength();
cType = in.getContentType();
}
public InputStream getInputStream()
throws IOException
{
return is;
}
public OutputStream getOutputStream()
{
return os;
}
public String getContentType()
{
return cType;
}
public String getName()
{
return "dummy";
}
}
========================================================================
Enrico Badella email: [EMAIL PROTECTED]
Soft*Star srl [EMAIL PROTECTED]
InterNetworking Specialists tel: +39-011-746092
Via Camburzano 9 fax: +39-011-746487
10143 Torino, Italy
Wanted, for hobbist use, any type of PDP and microVAX hardware,software,
manuals,schematics,etc. and DEC-10 docs or manuals
==========================================================================
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
READ THE FAQ!!!! <http://java.apache.org/faq/>
Archives and Other: <http://java.apache.org/main/mail.html/>
Problems?: [EMAIL PROTECTED]