aspose file tools*
The moose likes Applets and the fly likes Accessing Server Runtime from Applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Accessing Server Runtime from Applet" Watch "Accessing Server Runtime from Applet" New topic
Author

Accessing Server Runtime from Applet

Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
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
Bartender

Joined: Oct 14, 2005
Posts: 18669
    
    8

What "server" is that and what is that "Runtime" object you're talking about?
Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
The server that serves the Applet.

And I'm referring to the java.lang.Runtime object.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18669
    
    8

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

Joined: Sep 24, 2008
Posts: 323
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing Server Runtime from Applet