SendMail PostableResource

Pasquale Di Feo writes:
 > I have developed a simple PostableResource that send an e-mail
 > from a form.
 > 
 > I want return a file (specified in ATTR_REPLYFILE) for the response.
 > 
 > What is the best way ???


The simple answer is:

FileInputStream file = new FileInputStream(getValue(ATTR_REPLYFILE,null));
reply.setContentLength(file.available());
reply.setStream(file);
reply.setContentType(MIMEType.TEXT_HTML);
return reply;

Now thr right answer would be to create some FileResource, and to use
internal requests, unfortunatelly you will have to wait a couple more
weeks to get the details...

BTW the problem with the simple way is that as HTTP is getting more
and more complex, even simple things - such as serving a file - might
need more work then you thought...(weel simple way will work, but it
won't take advantage of HTTP/1.1 features)

Anselm.

Received on Friday, 26 July 1996 13:26:35 UTC