Related to the discussion about downloading a file from a servlet...

    Any thoughts on the best way of downloading a file from a session bean
to a remote client?

    I have a remote client which currently uses the URL and URLConnection
classes in java to utilize HTTP based conversations with a servlet which
would work fine if URLConnection did not insist on downloading everything
silently as part of  opening the connection.  I had supposed it would merely
download the header and then provide a stream to get the content.  Instead
it seems to want to download to a local version of the content which a
subsequent stream can access.  So the overall time is no worse than a web
browser but the user interaction is terrible: the user does not get to
choose a file name to save as, or see a progress bar until after the network
download is completed.

    I always thought a stateless session bean... or perhaps even a stateful
session bean... would be more appropriate except I can't see returning a
chunk of data of several 100 K to a few megs in size.  Also I note that EJB
beans aren't supposed to access the file system (a surprise! and the reasons
given in the spec weren't very convincing) and are not supposed to listen on
sockets (not a surprise).

    Any suggestions or comments?




Reply via email to