Meaningless Drivel is fun!*
The moose likes JSP and the fly likes Prevent Downloading files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Prevent Downloading files " Watch "Prevent Downloading files " New topic
Author

Prevent Downloading files

gopi thulasidoss
Greenhorn

Joined: Sep 07, 2007
Posts: 8
hi to all,

i am creating one online tutorial portal using jsp and servlets in the MVC pattern.I have the voice file repository in which user can ear the voice files(wav,mp3) randomly and attend the test.The problem is when i open the browser the other parties software like download manger which downloads the voice file ,is there any way to prevent downloading or encrypt the source of the audio files.

thanks in advance
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30130
    
150

Gopi,
Welcome to JavaRanch!

What happens when the browser sees an audio file is dependent on the user's configuration. There is nothing you can do on the server to force it to open inline if the user is set up that way.

If you don't need the audio to launch in a new file, you can embed it in the page though. This is how flash ads play sound and nested video stays on the page.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Note that you might be able to set up all audio file URLs so that they point to a servlet, rather than a file in the server public file hierarchy. That way you can verify each request and prevent someone grabbing the files directly.

Bill
gopi thulasidoss
Greenhorn

Joined: Sep 07, 2007
Posts: 8
with pleasure Jeeane,William


thanks for your suggestion...

My root url part is like that

http://localhost:8080/omtt/

in the jsp part

<embed src="Sounds/voice.mp3" > </embed>

The thing is my url part becomes like http://localhost:8080/omtt/Sounds/voice.mp3

i need to map the url part to prevent download, is there any encryption techniques....

The audience could able to ear but not to download ?
[ March 13, 2008: Message edited by: gopi thulasidoss ]
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Apparently "Sounds" is the name of your publicly addressable directory.

Suppose you had a servlet mapped to "Sounds" - when it gets the request it can look at the remainder of the URI to get the desired file, which can be read from a non-public directory. Before serving the sound file, it could examine the user's session to determine if this person is authorized to get that file at this time.

Probably the user could still get the file from the browser temporary file storage but it would be harder.

Bill
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Prevent Downloading files
 
Similar Threads
How to implement file downloading functionality ?
Websphere: prevent downloading of static content
Preventing access to .js files
How download file from http in .bat file?
To Bates about pdf version of Head First Servlets And Jsps