-
1. Re: Cyclic server life check with jsf 2.0
snjv180 Jul 10, 2012 5:43 AM (in response to suikast42)I think you can try to poll the server with ajax in some random time interval and if the request down't come then you know that the server has died and then show your error message.
-
2. Re: Cyclic server life check with jsf 2.0
suikast42 Jul 10, 2012 5:49 AM (in response to snjv180)I'm not so familar with javascript and ajax at the moment. Can you provide a little exapmple ?
-
3. Re: Cyclic server life check with jsf 2.0
snjv180 Jul 10, 2012 6:39 AM (in response to suikast42)Well you have the xhtml page and you can just write a scipt that interacts with a managed bean and in the java code u can evaluate the status of the server. So in this way you can find the server status and work correspondingly. For ajax in jsf 2 u can use the a4j components and for the server status u can look into the Net. I am sure you find something close enough.
-
4. Re: Cyclic server life check with jsf 2.0
jhuska Jul 10, 2012 7:16 AM (in response to suikast42)For polling server in some intervals you can use RichFaces component a4j:poll.
Simple use case is here:
http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=poll&skin=blueSky
In case of server shutdown an error response with code 500 is returned, so you can react on it.
-
5. Re: Cyclic server life check with jsf 2.0
suikast42 Jul 10, 2012 7:25 AM (in response to jhuska)How can I catch or handle the errorcode ?
-
6. Re: Cyclic server life check with jsf 2.0
jhuska Jul 11, 2012 3:31 AM (in response to suikast42)Not sure here (I am weak in JS), try to assign JS listener to in errror attribute or please search for other solution.