• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sound in servlet output stream

 
kartik krishnan
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

In servlet, I have a wav file present in the class path. I am sending the sound data as an output stream through http response. If I am redirecting to an another servlet, is there a way by which I can pick the sent output stream in the doGet of the redirect servlet.

Thanks,
Krishnan
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In servlet, I have a wav file present in the class path. I am sending the sound data as an output stream through http response. If I am redirecting to an another servlet, is there a way by which I can pick the sent output stream in the doGet of the redirect servlet.


Passing a reference to an open stream to another servlet sounds like a recipe for disaster. Much safer to pass a String giving the location of the wav file and let the receiving servlet decide what to do with it.

Bill
 
kartik krishnan
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tested it and scrapped that option. I am creating an audio stream and passing that as a Session attribute. It seems to be working so far.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So basically you have an open stream - which ties up one instance of the operating system's File resources - entirely dependent on the treatment of the session by all subsequent servlets in the web application.

Good luck - you will need it.

Bill
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65516
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kartik krishnan:
It seems to be working so far.

Translation: "I've created a time bomb that just hasn't gone off yet."
[ October 16, 2007: Message edited by: Bear Bibeault ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!