Streaming a file from an applet to a new browser window?
Victor Roberto Cardona
Joined: Feb 07, 2005
I would like to open a new browser window from an applet by using AppletContext.showDocument(). However, that method requires a URL. My content would be coming from an OutputStream opened by the applet. Does anyone know of a way to do this without creating a file, and thus requiring a signed applet? I am assuming that I will need to sign the applet, but I want to make sure before I go that route.
Welcome to the JavaRanch, Victor. You are correct in that an applet would need to be signed in order to read a local file, but the Java Tutorial has some options in the section on Applets titled Working with a Server-Side Application. Basically you write your data to the server and point the other window there. I recommend Java Servlets for a server-side technology. Much easier than writing your own server.
Thanks for the reply Joe. Thats what I thought the answer would be. I was just hoping that I had overlooked something. Anyway, I think I am going to go ahead and sign my applet, and let it save the file to the user's system. That seems better then bouncing a file against the server. Especially since the files might be a couple of MBs in size.