You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Paul Erion <pe...@gmail.com> on 2005/02/18 03:37:01 UTC

Serving up a Flash file

I'm using JBoss/Tomcat and JSP to serve up Flash (swf) files, but I'm
running into a little difficulty. The Flash file plays fine when the
browser is running on the same machine as the server; but, is a
no-show when I access the web page from a different machine -- though
the rest of the page (such as it is) is displayed. Oh, and the Flash
files are generated dynamically; in other words, there's not just one
flash file that I can squirrel away.

Following is the HTML that gets generated by the JSP (which "fills in"
the name of the Flash file to be displayed):

<HTML>
    <BODY bgcolor="#ffffff">
        <OBJECT width="300"  height="200"  align="center">
            <PARAM name="movie"   value="file:/C:/FlashFiles/test.swf">

            <EMBED src="file:/C:/FlashFiles/test.swf" 
type="application/x-shockwave-flash" width="300" height="200">
            </EMBED>
        </OBJECT>
    </BODY>
</HTML>

I've tried a couple of different values for the file specification
(for example, "file:///C:/FlashFiles/test.swf" and
"C:/FlashFiles/test.swf"), but this hasn't had any effect.  Is this a
security issue?  Any thoughts on what could be going on?

Thanks,

Paul

p.s., I'm using JBoss 3.2.3/Tomcat 4.1.29 on Windows XP Pro

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Serving up a Flash file

Posted by Shey Rab Pawo <pa...@gmail.com>.
Another way of responding to your question would be to say that your
conclusion about Mr. Bainbridge's remarks is only true if you let the
web server do all the work in retrieving the file.  Then, of course,
the reading of the entire request URL must be with the server.  That
is what you seem to have assumed must happen.  But, that is not
necessary.  That is not, in my opinion, even desirable, because it
ties your web application to the logic and the relationship between
the browser and the web server.  The web application ideally should be
decoupled from those assumptions, even if they are usually not.


On Fri, 18 Feb 2005 00:03:40 -0800, Paul Erion <pe...@gmail.com> wrote:
>     > Shey Rab Pawo <pa...@gmail.com> wrote:
>     > Your conclusion is not correct.  What Mr. Bainbridge told you is true,
>     > but that does not restrict where you can store the files on the server.
> 
> Ok, now I'm confused ...
> 
>    [Bainbridge]: What you need to do is generate the Flash file in
>            in a directory that Jboss/Tomcat serves files from like
>            webapps\yourwebappname\flash_files or similar or
>            similar and then the value= in your embed needs to be
>            relative to the location of the JSP that includes the tag.
> 
> My interpretation of the first part of the above is that the generated
> Flash files need to reside in the web app's directory structure.
> However, you're saying that that's not the case -- they can reside
> wherever on the server.  So, is it the second part of Mr. Bainbridge's
> statement that provides the clue for accessing these files?  That as
> long as the Flash file's path is specified relative to the location of
> the JSP (which includes the "embed" tag), then I'm good to go.
> 
> Paul
> 


-- 
The radiance of all the stars does not equal a sixteenth part of the
moon's radiance, likewise, good deeds giving us merit, all these do
not equal a sixteenth part of the merit of loving-kindness..

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Serving up a Flash file

Posted by Shey Rab Pawo <pa...@gmail.com>.
You need to break things down and to see what the browser is doing,
what your server is doing, what the web application is doing and what
your business logic is doing.  These all have differing parts to play
in this kind of a situation.  The "URL" is merely the communication
between the browser and your web server.  Your web server can
cooperate with your web application and do anything it wants
independent of the actual "URL" returned.  The HTTP URL is not like a
FILE address.  I use a Struts action, which involves a URL like
"resource.do?file=whatever.swf".  My web server, being aware I am
running Struts, notices that the URL ends in .do and sends the URL to
the Struts controller class, ActionServlet.  The Struts ActionServlet,
having read the configuration details for "resource.do",  sends the
request to a class I call ResourceAction.  ResourceAction is a request
processing class that retrieves resources like swf files and returns
them as an output stream to the client browser.  ResourceAction does
not care about the restrictions the server has in grabbing files and
can go anywhere on my server.  ResourceAction sees the name/value pair
"file=whatever.swf" and uses preprogrammed logic to go get the called
"whatever.swf".

You can do this a lot of different ways.  This is one.  

Do you understand?  It is best to get an idea of how it all works. 
This takes a while.  You will get it but you have to make sure you
understand what is happening, if you want to keep from being confused.


On Fri, 18 Feb 2005 00:03:40 -0800, Paul Erion <pe...@gmail.com> wrote:
>     > Shey Rab Pawo <pa...@gmail.com> wrote:
>     > Your conclusion is not correct.  What Mr. Bainbridge told you is true,
>     > but that does not restrict where you can store the files on the server.
> 
> Ok, now I'm confused ...
> 
>    [Bainbridge]: What you need to do is generate the Flash file in
>            in a directory that Jboss/Tomcat serves files from like
>            webapps\yourwebappname\flash_files or similar or
>            similar and then the value= in your embed needs to be
>            relative to the location of the JSP that includes the tag.
> 
> My interpretation of the first part of the above is that the generated
> Flash files need to reside in the web app's directory structure.
> However, you're saying that that's not the case -- they can reside
> wherever on the server.  So, is it the second part of Mr. Bainbridge's
> statement that provides the clue for accessing these files?  That as
> long as the Flash file's path is specified relative to the location of
> the JSP (which includes the "embed" tag), then I'm good to go.
> 
> Paul
> 


-- 
The radiance of all the stars does not equal a sixteenth part of the
moon's radiance, likewise, good deeds giving us merit, all these do
not equal a sixteenth part of the merit of loving-kindness..

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Serving up a Flash file

Posted by David Smith <dn...@cornell.edu>.
Just think out of the box a little on this one.  Your .swf file can be 
literally anywhere on the web and on any web server as long as it's 
accessible.  Then just write your code as:

<HTML>
    <BODY bgcolor="#ffffff">
        <OBJECT width="300"  height="200"  align="center">
            <PARAM name="movie"   value="http://www.some.webserver.com/someDir/test.swf">

            <EMBED src="http://www.some.webserver.com/someDir/test.swf" 
type="application/x-shockwave-flash" width="300" height="200">
            </EMBED>
        </OBJECT>
    </BODY>
</HTML>


You could also use relative urls such as "/someDir/test.swf", 
"./someDir/test.swf" or "test.swf" if you want as long as your .swf file 
is available on the same server as your .html or jsp.

As far as avoiding having serveral copies of the same file, that's 
really a matter of how you handle the dev project.  You could place them 
all in a directory on a server separate from your webapp and just link 
to them.  This option is a favorite of people who put their Tomcat 
service behind Apache and have Apache serve static content. 

Or (and I like this one better) have a one directory repository for all 
of the shared .swf files and use an ant compile task to copy them so 
they are included in building the .war file.  when you change one of the 
files, just re-run the ant builds and deploy your new .war files.  At 
your level, this might be one to keep in mind but not try until you have 
some other successes first.

--David

Paul Erion wrote:

>    > Shey Rab Pawo <pa...@gmail.com> wrote:
>    > Your conclusion is not correct.  What Mr. Bainbridge told you is true,
>    > but that does not restrict where you can store the files on the server.
>
>Ok, now I'm confused ...
>
>   [Bainbridge]: What you need to do is generate the Flash file in
>           in a directory that Jboss/Tomcat serves files from like
>           webapps\yourwebappname\flash_files or similar or
>           similar and then the value= in your embed needs to be
>           relative to the location of the JSP that includes the tag.
>
>My interpretation of the first part of the above is that the generated
>Flash files need to reside in the web app's directory structure. 
>However, you're saying that that's not the case -- they can reside
>wherever on the server.  So, is it the second part of Mr. Bainbridge's
>statement that provides the clue for accessing these files?  That as
>long as the Flash file's path is specified relative to the location of
>the JSP (which includes the "embed" tag), then I'm good to go.
>
>Paul
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Serving up a Flash file

Posted by Paul Erion <pe...@gmail.com>.
    > Shey Rab Pawo <pa...@gmail.com> wrote:
    > Your conclusion is not correct.  What Mr. Bainbridge told you is true,
    > but that does not restrict where you can store the files on the server.

Ok, now I'm confused ...

   [Bainbridge]: What you need to do is generate the Flash file in
           in a directory that Jboss/Tomcat serves files from like
           webapps\yourwebappname\flash_files or similar or
           similar and then the value= in your embed needs to be
           relative to the location of the JSP that includes the tag.

My interpretation of the first part of the above is that the generated
Flash files need to reside in the web app's directory structure. 
However, you're saying that that's not the case -- they can reside
wherever on the server.  So, is it the second part of Mr. Bainbridge's
statement that provides the clue for accessing these files?  That as
long as the Flash file's path is specified relative to the location of
the JSP (which includes the "embed" tag), then I'm good to go.

Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Serving up a Flash file

Posted by Shey Rab Pawo <pa...@gmail.com>.
Your conclusion is not correct.  What Mr. Bainbridge told you is true,
but that does not restrict where you can store the files on the
server.

> So, if I understand you (and remember
> I'm a bit dense) it's just not possible, via the "embed/object" tag to
> specify/access a file that doesn't reside in the directory hierarchy
> that JBoss/Tomcat serves files from.
> 


-- 
The radiance of all the stars does not equal a sixteenth part of the
moon's radiance, likewise, good deeds giving us merit, all these do
not equal a sixteenth part of the merit of loving-kindness..

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Serving up a Flash file

Posted by Paul Erion <pe...@gmail.com>.
    > Jason Bainbridge <jb...@gmail.com> wrote:
    > Okay that scares me, you're developing web applications ...

Don't worry.  No one's paying me for this -- I'm just fooling around
on my own, trying to learn some stuff

    > ... but don't know what the file:/ URI does?

Well, I *am* kind of an idiot -- and I'm also pretty sure that nothing
that I write here will disprove it.

    > Anyway why it works on the localhost is that it is trying to load the
    > file from the C: drive of the machine the page is opened on and well
    > it's there on the server but obviously not on the client.

Thanks for the explanation.  I was erroneously assuming that the URL
would be evaluated in the context of the server.

    > What you need to do is generate the Flash file in a directory that
    > Jboss/Tomcat serves files from like webapps\yourwebappname\flash_files
    > or similar and then the value= in your embed needs to be relative to
    > the location of the JSP that includes the tag.

This makes it interesting ... in the scenario that I'm envisioning,
the Flash files are generated prior to a user's request to view the
file, and there's not a fixed number of files (that is, new files will
be continuously generated).  Consequently, I didn't want to store the
files in the same directory hierarchy as the web app (somehow that
didn't seem like a good idea).   So, if I understand you (and remember
I'm a bit dense) it's just not possible, via the "embed/object" tag to
specify/access a file that doesn't reside in the directory hierarchy
that JBoss/Tomcat serves files from.

Once thanks for the info, it was helpful.  And if  you have any other
thoughts, suggestions, or pointers to docs, I'd love to hear them.

Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Serving up a Flash file

Posted by Jason Bainbridge <jb...@gmail.com>.
On Thu, 17 Feb 2005 18:37:01 -0800, Paul Erion <pe...@gmail.com> wrote:

> Following is the HTML that gets generated by the JSP (which "fills in"
> the name of the Flash file to be displayed):
> 
> <HTML>
>     <BODY bgcolor="#ffffff">
>         <OBJECT width="300"  height="200"  align="center">
>             <PARAM name="movie"   value="file:/C:/FlashFiles/test.swf">
> 
>             <EMBED src="file:/C:/FlashFiles/test.swf"
> type="application/x-shockwave-flash" width="300" height="200">
>             </EMBED>
>         </OBJECT>
>     </BODY>
> </HTML>

Okay that scares me, you're developing web applications but don't know
what the file:/ URI does?

Anyway why it works on the localhost is that it is trying to load the
file from the C: drive of the machine the page is opened on and well
it's there on the server but obviously not on the client.

What you need to do is generate the Flash file in a directory that
Jboss/Tomcat serves files from like webapps\yourwebappname\flash_files
or similar and then the value= in your embed needs to be relative to
the location of the JSP that includes the tag.

Regards,
-- 
Jason Bainbridge
KDE - Conquer Your Desktop - http://kde.org
KDE Web Team - webmaster@kde

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Serving up a Flash file

Posted by B Wiley <in...@wileynet.com>.
>"It's amazing how large some
>of the gaps in my knowledge truly are."

Words of a wise man. I find myself thinking the same thing daily. I'm sure 
we are not alone :)






---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Serving up a Flash file

Posted by Paul Erion <pe...@gmail.com>.
Thanks to everyone for their responses.  It's amazing how large some
of the gaps in my knowledge truly are.

Paul

p.s., Sorry I didn't mean to disappear ... water is an amazing thing,
given enough volume, it can get into all sorts of places you wouldn't
expect; so I've been learning all sorts of things about filling
sandbags, their proper placement, and how tired one can get carrying
those puppies around.  Ahh, sunny southern California, where it hardly
ever rains.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org