This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Servlets and the fly likes Servlet/java method for triggering event when system is locked Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet/java method for triggering event when system is locked" Watch "Servlet/java method for triggering event when system is locked" New topic
Author

Servlet/java method for triggering event when system is locked

sanuji pillai
Greenhorn

Joined: Jul 05, 2010
Posts: 24
Hi,

I am looking for example code in java/Servlet to trigger an Event when the System-Monitor is Locked, and should Trigger Event when its unlocked.

Regards,

Sanuji Pillai.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63232
    
  69

Servlets execute on the server in response to a request from the browser. There is no way for them to be triggered in some client system event that has nothing to do with an HTTP request.

What are you actually trying to accomplish?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
sanuji pillai
Greenhorn

Joined: Jul 05, 2010
Posts: 24

Thank You for your Valuable Response.


Actually i want to create Daemon Process in java. It will push data to the Data-Base when just before our System is Locked/unlocked/logged out ..etc.

So anyway we need to capture those events right?. Is it possible in Java.

Thank You,

Sanuji Pillai.
Narayana Padmanabhuni
Greenhorn

Joined: Aug 01, 2011
Posts: 4
sanuji pillai wrote:Hi,

I am looking for example code in java/Servlet to trigger an Event when the System-Monitor is Locked, and should Trigger Event when its unlocked.

Regards,

Sanuji Pillai.


You can do that using SessionListener in Servlets. The listener will be notified when the session has been inactivated and activated.
Narayana Padmanabhuni
Greenhorn

Joined: Aug 01, 2011
Posts: 4
Even you can trace if an attribute has been placed or removed from the session using SessionAttributeListener.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63232
    
  69

He is not asking about session timeouts.

Servlets is not the answer to responding to client system events that do not involve a page loaded by a web application.
sanuji pillai
Greenhorn

Joined: Jul 05, 2010
Posts: 24
I am not talking about session, i am talking about capturing OS related events like Logout/Login/Shutdown/Restart/Monitor-Lock ..etc.

Our Daemon Java program should capture these EVENTS.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63232
    
  69

Again, servlets is not the technology you are looking for.
 
Have you checked out Aspose?
 
subject: Servlet/java method for triggering event when system is locked
 
It's not a secret anymore!