Kalbrener, Cyrus wrote:
>
> Possibly, but what if I need to send a binary file some time in the
> future? Or multiple files? Or files and data?
Easiest way to go is to send one file per request in binary format.
There's no diff between a text or binary file. Both are just bytes.
If you want to send multiple files, do so with multiple requests. You
can even do keep-alive if you want.
> The problem is I need to be able to create a distribuatable client
> that I can trust to send data in a decipherable way regardless of what
> kind of file(s) are pumped through it. It may mean using a
> ServletInputStream on the server side and sifting through the data
> myself.
>
> I am hoping that there is something I can use that is similar to
> javax.mail.internet.MimeMultipart to assemble the pieces and send them
> off as part of a POST request. Failing that, some insight into how a
> POST request is formatted might help.
You can definitely encode the request into a "standard" format. The big
advantage there is if you plan to leverage other people's tools or
utils. If you're working in isolation, I'd just pump the file data in
the POST body, and use HTTP headers to describe the posted content.
They don't even have to be standard headers necessarily since you
control both ends.
If you want to go the standard route, you could write the client half
of a multi-part/form-data request. It'd be fairly easy since you don't
have to do any error checking. You'd lose some of the flexibility
gained by "rolling your own" method. I'm not sure if there's a helper
class anywhere for that.
-jh-
--
Jason Hunter
[EMAIL PROTECTED]
Book: http://www.servlets.com/book
Article: http://www.javaworld.com/jw-12-1998/jw-12-servletapi.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html