• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Deploying applets in a web application

 
Sayak Banerjee
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?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • 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: 42969
73
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic