• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Deploying applets in a web application

 
Ranch Hand
Posts: 292
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When applets are deployed in a web application, the applet class files are placed in the same directory as the HTML file or in a sub-directory. But, by doing this, the applet class file can be accessed by the client directly. My question is-- is there a way to place the applet class file under WEB-INF/classes(so that it's prevented from direct access) and still get it to work. I couldn't get it to work that way. Also, the "codebase" attribute in the <applet> tag can't be of any help here--am I right?
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing inside of WEB-INF is ever served to the client, so that wouldn't work.

You're right that the client can access the classes (or jars) directly, but that's the point - to the web server it makes no difference whether it's a browser downloading those files because the user typed in the URLs, or if the client JVM downloads them. Bothe result in the same HTTP accesses.

The bottom line is: applet classes can be downloaded and inspected by the client; that's just how it works.
 
Sayak Banerjee
Ranch Hand
Posts: 292
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf.
 
Sayak Banerjee
Ranch Hand
Posts: 292
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, I think the only workaround(if we don't want the client to directly access the applet class) would be to place the HTML under WEB-INF and the applet class package under WEB-INF/classes and then have a servlet dispatch the request to the HTML file.
 
Ulf Dittmer
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No - applet classes can't be inside of WEB-INF, ever. It makes no difference where the HTML file resides.

You can cook up a scheme involving a custom ClassLoader, which loads the classes through a servlet - then you can keep them inside WEB-INF. That would make it harder to get at the classes, but by no means impossible.
 
Sayak Banerjee
Ranch Hand
Posts: 292
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:
No - applet classes can't be inside of WEB-INF, ever. It makes no difference where the HTML file resides.

You can cook up a scheme involving a custom ClassLoader, which loads the classes through a servlet - then you can keep them inside WEB-INF. That would make it harder to get at the classes, but by no means impossible.



Yeah....very true....'twas a wrong conclusion I came to yesterday....thanks again for clarifying the point.
 
Men call me Jim. Women look past me to this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic