• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Writing file to Response vs serving file using the context path

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 171
Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have any error/exceptions on the same when it's not working?
 
Sheriff
Posts: 67590
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...

This isn't a java issue, JW Player only supports HTTP Psuedo Streaming and RTMP Streaming. They're both their own protocols

.

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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic