• Post Reply Bookmark Topic Watch Topic
  • New Topic

Writing file to Response vs serving file using the context path  RSS feed

 
Juggy Obhi
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a flash file (.flv) which i want to display as a video in JW player. It is very strange to know that when i keep that FLV file on some path in the server and let the user get it with a simple url e.g. http://mysite/mycontext/myflv.flv, the video appears on the screen whereas when i use a servet and write the flv file in the HttpServletResponse with proper headers like content length, content type, content disposition, the file do not play on the browser however if i manually put the URL (direct url to the file OR servlet url which writes the file to the response object), the result is same, i get a SAVE AS window on the browser.

I really need to understand the difference between Writing file to Response VS serving file using the context path.


Thanks in Advance.

Regards.
 
Kumaravadivel Subramani
Ranch Hand
Posts: 171
Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have any error/exceptions on the same when it's not working?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66208
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There really isn't much difference. After all, that's exactly what the server is doing when you hit the file via its path. Perhaps you could use an HTTP sniffing tool to see what's different in the response between the two scenarios.
 
Juggy Obhi
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many thanks for the guidance.
There really isn't much difference. After all, that's exactly what the server is doing when you hit the file via its path.
That's exactly what i think. I had checked the response using web sniffer for both of these two and found no difference However i learned in one of the forum that it is no a java issue...
.

It seems that when the path is provided JW player knows how to stream it and handles it well whereas when done manually using a servlet, JW player fails as in this case the streaming is not done in manner JW player can handle and process.

I will try to learn and implement JW player supported streaming.


Thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!