• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

File outside war

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.
Using Flex3 I've created a simple VideoPlayer, it works fine, just as it should. Now i want to embed it into a JSP page. I've written something like this:


The VideoPlayer shows up on the page, it works but it does't play the movie located at D:/video.flv
The war archive is deployed in the JBoss deploy dir. When the movie is in the application archive the player plays the movie, but when the video file is somewhere else, outside the archive (like in this example) then the player doesn't play anything.
My question is how to gain access to the video file which is outside the war file?
 
Sheriff
Posts: 67746
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
Think about it for a minute. You are telling the browser to look on the D drive. The browser. The browser that runs on the client.

For this to work, every visitor would need to have the file sitting on their local D drives. If they have one. And are running Windows.

You must address the file by URL, not by file path.
 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First, the url sent needs to be a full web accessible URL, "d:\" only work on your desktop, and outside of a web browser. using "file://" might work, but also only if the browser was on the same machine as the jboss server.

What we need to do is cause that content folder to be served through a HTTP url some how.,

in this case, i would recommend having your jboss app server connected behind an apache server, with mod_jk, perhaps mounted on point /app
so that hitting your page /app/VideoPlayer.jsp would load this page with the flash tags, etc.

and then have the source variable be


where the path /content is mapped to the d:\ folder and is handled by apache , such as a simple directory folder .



Note however this does not enforce any login or security filtering, so anyone with a HTTP client could navigate the contents of the content folder. and thats why we don't have "Options Indexes" in there.

If you did want to continue using just jboss, without getting into using apache, or wanted to have some kind of security filtering, requiring the users to first log in before getting the content, you would need to create a file streamer servlet and have that mapped to (for example, /content/* in your web.xml in your app)

Here is a simple example of this, where it takes the path following the servlet mapping and tries to resolve that to a file name inside the content folder (d:\ in this case)



Where this servlet doesn't do any "is logged in checking", I was thinking a servlet filter would do that for us, mapped to /content/* as well.

If there is no requirement to have users logged in before getting the content, I would recommend letting apache serve the media content, as a native process it might handle high thrughputs better, and certainly would not cause the precious resource of worker threads in jboss to be tied up to serve this static content.
 
Grzegorz Novvak
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the replies

I have few questions.

The solution with two servers is new to me, I've looked up for tutorials or hints how to do it, I've found these two:
http://www.jboss.org/community/wiki/UsingModjk12WithJBoss
http://www.redhat.com/docs/en-US/JBoss_Enterprise_Application_Platform/4.3.0.cp03/html/Server_Configuration_Guide/clustering-http.html
Is it a good point to start with? I'll look into this when I have more time.

The solution with a servlet.
As I understand this solution is similar to downloading a file from the server to a local machine, am I right?
What would be the value of the source var in my JSP which I pass to Flex? Just the name of the video file?

The app and the server runs on my PC
 
Travis Hein
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, I think the servlet approach would still need to use a full HTTP front end URL.

JBoss on its own without apache still has an internal HTTP server built into it, the servlet JSP code is only ran within the server, communicating to it with a browser client is done with rendered HTML over HTTP still.

so the url value for 'source' would be the path as would be seen by your web browser connecting to the JBoss service, plus the contextPath of the webapp, and the servletPath we have mapped the content file servlet to, and then the name of the content file within our file system folder.

http://${host}[:${port}]?//${contextPath}/${servletPath}/${fileName}

where ${fileName} should exist in "d:\"
 
reply
    Bookmark Topic Watch Topic
  • New Topic