You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Will Etson <Wi...@pgn.com> on 2002/09/10 20:42:22 UTC
[OT]RE: accessing large/multiple files on hard drive
Are you trying to access the files from Java or just reference them via html? If you just want a reference, Tomcat and most other web servers have a notion of a virtual directory. I believe with tomcat you can set this up with context entry pointing to some random directory. If you want to reference the MP3s via Java, I used a property file to indicate the directory the my mp3s are stored in along with the virtual reference from the new Tomcat Context. This is essentially the same as having two web applications. One being deployed as an ear and one as an web application with its document root as a directory reference to the mp3 collection. The only draw back I found to this is that tomcat treats mime mappings somewhat strangely. ".MP3" and ".mp3" are not equal. ".mp3" returns the right mime mapping and ".MP3" was returned as an octet string.
P.S. If some one has a better solution I be glad to hear it. I toyed around with the idea of hijacking the Invoker servlet with a struts action but I didn't feel this was very portable and the purpose of this app was to demonstrate best practices i.e. portability.
>>> <wb...@Ensign-BickfordInd.com> 09/09/02 02:06PM >>>
This has got to be a candidate for the worst, messiest solution ever...
Worse comes to worse, you could have two applications... one that holds
and serves up the mp3 files and the other that does all the other
work...
I'm sure there is a hole a mile wide in this idea...
-----Original Message-----
From: ekbush [ mailto:ekbush@swbell.net]
Sent: Monday, September 09, 2002 4:39 PM
To: struts-user
Subject: Re: accessing large/multiple files on hard drive
That could get quite tricky if you're running out of a WAR archive. If
your application is deployed in "unpacked" format, then you could
sym-link (on Un*x anyway) to it I would think. So you'd wind up with a
sym-link in your root (or protected under WEB-INF) that pointed to the
real directory. I can't think of another elegant solution. Maybe
someone else can.
Regards,
Eddie
Nani Jon wrote:
>Hi:
>
>Here is my sitiuation. I have deployed my application war file to a
JBoss_Tomcat caontainer. I have developed this app using struts. I am
trying to access multiple music files (mp3 format) form this app. I
don't want to wrap all of my mp3 files which total to about 1 GB in my
war file. This makes for a very lenghty deploy process, especially when
it is work in progress. I just want to put them in a directory on the
server where Tomcat is running and point to that directory in my
application. How is this done. Your help is greatly appreciated.
>
>Thanks,
>
>Nanijon.
>
--
To unsubscribe, e-mail:
< mailto:struts-user-unsubscribe@jakarta.apache.org >
For additional commands, e-mail:
< mailto:struts-user-help@jakarta.apache.org >
Re: [OT]RE: accessing large/multiple files on hard drive
Posted by Nani Jon <na...@yahoo.com>.
Will:
I am just trying to reference them in my JSP page. I have constructed a URL which points to the .mp3 file: http://jupiter/music/mp3/song1.mp3 This is part of an iterate loop <logic:iterate ... So, when the user clicks on the link the file will start streaming from a directory on the hard drive. I would appreciate your suggestions.
Thanks,
Nanijon.
Will Etson wrote:Are you trying to access the files from Java or just reference them via html? If you just want a reference, Tomcat and most other web servers have a notion of a virtual directory. I believe with tomcat you can set this up with context entry pointing to some random directory. If you want to reference the MP3s via Java, I used a property file to indicate the directory the my mp3s are stored in along with the virtual reference from the new Tomcat Context. This is essentially the same as having two web applications. One being deployed as an ear and one as an web application with its document root as a directory reference to the mp3 collection. The only draw back I found to this is that tomcat treats mime mappings somewhat strangely. ".MP3" and ".mp3" are not equal. ".mp3" returns the right mime mapping and ".MP3" was returned as an octet string.
P.S. If some one has a better solution I be glad to hear it. I toyed around with the idea of hijacking the Invoker servlet with a struts action but I didn't feel this was very portable and the purpose of this app was to demonstrate best practices i.e. portability.
>>> 09/09/02 02:06PM >>>
This has got to be a candidate for the worst, messiest solution ever...
Worse comes to worse, you could have two applications... one that holds
and serves up the mp3 files and the other that does all the other
work...
I'm sure there is a hole a mile wide in this idea...
-----Original Message-----
From: ekbush [ mailto:ekbush@swbell.net]
Sent: Monday, September 09, 2002 4:39 PM
To: struts-user
Subject: Re: accessing large/multiple files on hard drive
That could get quite tricky if you're running out of a WAR archive. If
your application is deployed in "unpacked" format, then you could
sym-link (on Un*x anyway) to it I would think. So you'd wind up with a
sym-link in your root (or protected under WEB-INF) that pointed to the
real directory. I can't think of another elegant solution. Maybe
someone else can.
Regards,
Eddie
Nani Jon wrote:
>Hi:
>
>Here is my sitiuation. I have deployed my application war file to a
JBoss_Tomcat caontainer. I have developed this app using struts. I am
trying to access multiple music files (mp3 format) form this app. I
don't want to wrap all of my mp3 files which total to about 1 GB in my
war file. This makes for a very lenghty deploy process, especially when
it is work in progress. I just want to put them in a directory on the
server where Tomcat is running and point to that directory in my
application. How is this done. Your help is greatly appreciated.
>
>Thanks,
>
>Nanijon.
>
--
To unsubscribe, e-mail:
< mailto:struts-user-unsubscribe@jakarta.apache.org >
For additional commands, e-mail:
< mailto:struts-user-help@jakarta.apache.org >
---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes