Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing Server Runtime from Applet

 
Bai Shen
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to get access to the servers Runtime object from inside my applet. Is there an easy way to do this? I don't need access to anything on the client. Just the server.
 
Paul Clapham
Sheriff
Pie
Posts: 20758
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What "server" is that and what is that "Runtime" object you're talking about?
 
Bai Shen
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The server that serves the Applet.

And I'm referring to the java.lang.Runtime object.
 
Paul Clapham
Sheriff
Pie
Posts: 20758
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I still don't understand. Your applet is served by an HTTP server. Which doesn't have to be written in Java at all.

Anyway even if that server is written in Java, there's no way for clients to access its internals. Terribly bad idea from the security point of view. Where did this strange idea come from?
 
Bai Shen
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:I still don't understand. Your applet is served by an HTTP server. Which doesn't have to be written in Java at all.


Really? I didn't know that.

Anyway even if that server is written in Java, there's no way for clients to access its internals. Terribly bad idea from the security point of view. Where did this strange idea come from?


I have a legacy applet that I have to support. It's very convoluted and "enterprisey". When a user first logs into the applet, it pushes out a large chunk of data. Being hosted on Tomcat, the memory usage would shoot up. If too many users logged on at once, it would cause the JVM to crash with an out of memory exception. To prevent this from happening, a call to the Runtime object was added to check the available memory. If there wasn't enough left, it would deny the login. Once a minute or so had passed and the memory had cleared, the call would allow the log in.

Not the greatest solution, but it worked. Now, however, I'm having to redo the whole log in process(long story why), and I'm trying to incorporate this memory check into the new process. But I guess I could just do it in the log in servlet instead of the applet.

I think I just answered my own question.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic