Java Reference
In-Depth Information
terface for working with data in a variety of formats and from a variety of sources. DataHand-
ler can automatically detect the MIME type of the object passed to it, so it is able to add the
MIME content type to the attachment transparently. Because you constructed it with a URL,
it privately creates a URLDataSource object, which is also new in Java SE 6. This class im-
plements the DataSource interface, giving you access to the data as input and output streams.
There are two main things that you need to know about DataHandler in this context: it is the
most convenient way to get non-string data into a SAAJ attachment, and when you need to
deal with the data once you've retrieved it from the attachment, you can use a standard In-
putStream to read it and an OutputStream to write it.
You saw how to use a source with SAAJ messages earlier, so I won't belabor that here.
See Also
Connecting to a SAAJ Endpoint Without a WSDL .
Search WWH ::




Custom Search